From 5d118d0a922334e47db5159089d74dda21329b74 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Wed, 14 May 2025 15:10:35 +0200 Subject: [PATCH] gh-133580: Add missing exception to _sys_getwindowsversion_from_kernel32 (GH-133574) --- .../next/Windows/2025-05-07-13-04-22.gh-issue-133580.jBMujJ.rst | 1 + Python/sysmodule.c | 1 + 2 files changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Windows/2025-05-07-13-04-22.gh-issue-133580.jBMujJ.rst 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; -- 2.47.3