From 4db8146427a756b97639faca4f954f2c516f27ae Mon Sep 17 00:00:00 2001 From: thexai <58434170+thexai@users.noreply.github.com> Date: Sat, 4 Jul 2026 18:58:00 +0200 Subject: [PATCH 1/2] gh-152433: Windows: allow build ``overlapped.c`` for UWP --- ...026-07-04-18-57-47.gh-issue-152433.tO5k5t.rst | 1 + Modules/overlapped.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 Misc/NEWS.d/next/Windows/2026-07-04-18-57-47.gh-issue-152433.tO5k5t.rst diff --git a/Misc/NEWS.d/next/Windows/2026-07-04-18-57-47.gh-issue-152433.tO5k5t.rst b/Misc/NEWS.d/next/Windows/2026-07-04-18-57-47.gh-issue-152433.tO5k5t.rst new file mode 100644 index 000000000000000..126880f5a9ef0dd --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2026-07-04-18-57-47.gh-issue-152433.tO5k5t.rst @@ -0,0 +1 @@ +Allow build ``overlapped.c`` for UWP. diff --git a/Modules/overlapped.c b/Modules/overlapped.c index 255576cc057cdd4..b7dea3802e4fbd2 100644 --- a/Modules/overlapped.c +++ b/Modules/overlapped.c @@ -35,6 +35,10 @@ #define T_HANDLE T_POINTER +#ifndef HasOverlappedIoCompleted +#define HasOverlappedIoCompleted(lpOverlapped) (lpOverlapped)->Internal != STATUS_PENDING +#endif + /*[python input] class pointer_converter(CConverter): format_unit = '"F_POINTER"' @@ -359,6 +363,9 @@ _overlapped_RegisterWaitWithQueue_impl(PyObject *module, HANDLE Object, DWORD Milliseconds) /*[clinic end generated code: output=c2ace732e447fe45 input=2dd4efee44abe8ee]*/ { +#ifndef MS_WINDOWS_DESKTOP + return NULL; +#else HANDLE NewWaitObject; struct PostCallbackData data = {CompletionPort, Overlapped}, *pdata; @@ -381,6 +388,7 @@ _overlapped_RegisterWaitWithQueue_impl(PyObject *module, HANDLE Object, } return Py_BuildValue(F_HANDLE, NewWaitObject); +#endif } /*[clinic input] @@ -396,6 +404,9 @@ static PyObject * _overlapped_UnregisterWait_impl(PyObject *module, HANDLE WaitHandle) /*[clinic end generated code: output=ec90cd955a9a617d input=a56709544cb2df0f]*/ { +#ifndef MS_WINDOWS_DESKTOP + Py_RETURN_NONE; +#else BOOL ret; Py_BEGIN_ALLOW_THREADS @@ -405,6 +416,7 @@ _overlapped_UnregisterWait_impl(PyObject *module, HANDLE WaitHandle) if (!ret) return SetFromWindowsErr(0); Py_RETURN_NONE; +#endif } /*[clinic input] @@ -422,6 +434,9 @@ _overlapped_UnregisterWaitEx_impl(PyObject *module, HANDLE WaitHandle, HANDLE Event) /*[clinic end generated code: output=2e3d84c1d5f65b92 input=953cddc1de50fab9]*/ { +#ifndef MS_WINDOWS_DESKTOP + Py_RETURN_NONE; +#else BOOL ret; Py_BEGIN_ALLOW_THREADS @@ -431,6 +446,7 @@ _overlapped_UnregisterWaitEx_impl(PyObject *module, HANDLE WaitHandle, if (!ret) return SetFromWindowsErr(0); Py_RETURN_NONE; +#endif } /* From feba92a4c63954071756f9886e9f8230aca31067 Mon Sep 17 00:00:00 2001 From: thexai <58434170+thexai@users.noreply.github.com> Date: Mon, 6 Jul 2026 17:39:04 +0200 Subject: [PATCH 2/2] Improve NEWS entry --- .../next/Windows/2026-07-04-18-57-47.gh-issue-152433.tO5k5t.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Windows/2026-07-04-18-57-47.gh-issue-152433.tO5k5t.rst b/Misc/NEWS.d/next/Windows/2026-07-04-18-57-47.gh-issue-152433.tO5k5t.rst index 126880f5a9ef0dd..fa814a5fb3bbc0a 100644 --- a/Misc/NEWS.d/next/Windows/2026-07-04-18-57-47.gh-issue-152433.tO5k5t.rst +++ b/Misc/NEWS.d/next/Windows/2026-07-04-18-57-47.gh-issue-152433.tO5k5t.rst @@ -1 +1 @@ -Allow build ``overlapped.c`` for UWP. +Allow build :mod:`!_overlapped` module for Universal Windows Platform.