https://github.com/python/cpython/commit/5d118d0a922334e47db5159089d74dda21329b74
commit: 5d118d0a922334e47db5159089d74dda21329b74
branch: main
author: Max Bachmann <kont...@maxbachmann.de>
committer: zooba <steve.do...@microsoft.com>
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 -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to