]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-133580: Add missing exception to _sys_getwindowsversion_from_kernel32 (GH-133574)
authorMax Bachmann <kontakt@maxbachmann.de>
Wed, 14 May 2025 13:10:35 +0000 (15:10 +0200)
committerGitHub <noreply@github.com>
Wed, 14 May 2025 13:10:35 +0000 (14:10 +0100)
Misc/NEWS.d/next/Windows/2025-05-07-13-04-22.gh-issue-133580.jBMujJ.rst [new file with mode: 0644]
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 (file)
index 0000000..414a6f8
--- /dev/null
@@ -0,0 +1 @@
+Fix :func:`sys.getwindowsversion` failing without setting an exception when called on some WinAPI partitions.
index b46c2ab7c4483dd2547343dedfb28e4becf7688f..dd048205757eb1f59e6bbc92547e3511f450d9c1 100644 (file)
@@ -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;