https://github.com/python/cpython/commit/9ab9181509fdf0f2af9f3d8204272e3bd37b633b
commit: 9ab9181509fdf0f2af9f3d8204272e3bd37b633b
branch: main
author: thexai <[email protected]>
committer: chris-eibl <[email protected]>
date: 2026-09-11T15:35:18+02:00
summary:

gh-152433: Windows: allow build ``overlapped.c`` for UWP (#153036)

files:
A Misc/NEWS.d/next/Windows/2026-07-04-18-57-47.gh-issue-152433.tO5k5t.rst
M Modules/overlapped.c

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 00000000000000..fa814a5fb3bbc0
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2026-07-04-18-57-47.gh-issue-152433.tO5k5t.rst
@@ -0,0 +1 @@
+Allow build :mod:`!_overlapped` module for Universal Windows Platform.
diff --git a/Modules/overlapped.c b/Modules/overlapped.c
index 646cb66605295e..f8b654594ebfc6 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"'
@@ -351,6 +355,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;
 
@@ -373,6 +380,7 @@ _overlapped_RegisterWaitWithQueue_impl(PyObject *module, 
HANDLE Object,
     }
 
     return Py_BuildValue(F_HANDLE, NewWaitObject);
+#endif
 }
 
 /*[clinic input]
@@ -388,6 +396,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
@@ -397,6 +408,7 @@ _overlapped_UnregisterWait_impl(PyObject *module, HANDLE 
WaitHandle)
     if (!ret)
         return SetFromWindowsErr(0);
     Py_RETURN_NONE;
+#endif
 }
 
 /*[clinic input]
@@ -414,6 +426,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
@@ -423,6 +438,7 @@ _overlapped_UnregisterWaitEx_impl(PyObject *module, HANDLE 
WaitHandle,
     if (!ret)
         return SetFromWindowsErr(0);
     Py_RETURN_NONE;
+#endif
 }
 
 /*

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to