From 5dc09ad19726475f8e32e3b107dfa012d63e90de Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Wed, 7 May 2025 14:28:07 +0200 Subject: [PATCH 1/4] add missing exception in _sys_getwindowsversion_from_kernel32 --- Python/sysmodule.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 00dce4527fbb90..71cd8783993e41 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_SetFromWindowsErr(0); return NULL; #else HANDLE hKernel32; From 064806d9d777aa13be4e8a26dcbc1587173697ff Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 7 May 2025 13:04:24 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Windows/2025-05-07-13-04-22.gh-issue-133580.jBMujJ.rst | 1 + 1 file changed, 1 insertion(+) 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 00000000000000..c755149e073d3a --- /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 From 5e5552bd3245d298b165ea9f813f75a07c53b8be Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Sun, 11 May 2025 21:46:11 +0200 Subject: [PATCH 3/4] Update Misc/NEWS.d/next/Windows/2025-05-07-13-04-22.gh-issue-133580.jBMujJ.rst Co-authored-by: Peter Bierma --- .../next/Windows/2025-05-07-13-04-22.gh-issue-133580.jBMujJ.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index c755149e073d3a..414a6f87e651ae 100644 --- 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 @@ -1 +1 @@ -Fix :func:`sys.getwindowsversion` failing without setting an exception when called on some WinAPI partitions +Fix :func:`sys.getwindowsversion` failing without setting an exception when called on some WinAPI partitions. From 18c9e0241ce4dbfdcd42fdea129c0318f20c28bc Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Wed, 14 May 2025 14:11:08 +0200 Subject: [PATCH 4/4] Update Python/sysmodule.c Co-authored-by: Steve Dower --- Python/sysmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 71cd8783993e41..84836a7b516d76 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1643,7 +1643,7 @@ static PyObject * _sys_getwindowsversion_from_kernel32(void) { #ifndef MS_WINDOWS_DESKTOP - PyErr_SetFromWindowsErr(0); + PyErr_SetString(PyExc_OSError, "cannot read version info on this platform"); return NULL; #else HANDLE hKernel32;