From: Max Bachmann Date: Wed, 14 May 2025 13:10:35 +0000 (+0200) Subject: gh-133580: Add missing exception to _sys_getwindowsversion_from_kernel32 (GH-133574) X-Git-Tag: v3.15.0a1~1726 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5d118d0a922334e47db5159089d74dda21329b74;p=thirdparty%2FPython%2Fcpython.git gh-133580: Add missing exception to _sys_getwindowsversion_from_kernel32 (GH-133574) --- 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 000000000000..414a6f87e651 --- /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 b46c2ab7c448..dd048205757e 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;