https://github.com/python/cpython/commit/5d118d0a922334e47db5159089d74dda21329b74
commit: 5d118d0a922334e47db5159089d74dda21329b74
branch: main
author: Max Bachmann <[email protected]>
committer: zooba <[email protected]>
date: 2025-05-14T14:10:35+01:00
summary:
gh-133580: Add missing exception to _sys_getwindowsversion_from_kernel32
(GH-133574)
files:
A Misc/NEWS.d/next/Windows/2025-05-07-13-04-22.gh-issue-133580.jBMujJ.rst
M Python/sysmodule.c
diff --git
a/Misc/NEWS.d/next/Windows/2025-05-07-13-04-22.gh-issue-133580.jBMujJ.rst
b/Misc/NEWS.d/next/Windows/2025-05-07-13-04-22.gh-issue-133580.jBMujJ.rst
new file mode 100644
index 00000000000000..414a6f87e651ae
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2025-05-07-13-04-22.gh-issue-133580.jBMujJ.rst
@@ -0,0 +1 @@
+Fix :func:`sys.getwindowsversion` failing without setting an exception when
called on some WinAPI partitions.
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index b46c2ab7c4483d..dd048205757eb1 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1643,6 +1643,7 @@ static PyObject *
_sys_getwindowsversion_from_kernel32(void)
{
#ifndef MS_WINDOWS_DESKTOP
+ PyErr_SetString(PyExc_OSError, "cannot read version info on this
platform");
return NULL;
#else
HANDLE hKernel32;
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]