https://github.com/python/cpython/commit/07f33ceb3a3bfe0f0bb95a11141d0159bf3c0aec
commit: 07f33ceb3a3bfe0f0bb95a11141d0159bf3c0aec
branch: main
author: thexai <[email protected]>
committer: chris-eibl <[email protected]>
date: 2026-09-11T12:18:43+02:00
summary:
gh-152433: Windows: ``_winapi`` module: improve UWP compatibility (#152962)
files:
A Misc/NEWS.d/next/Windows/2026-07-03-17-07-40.gh-issue-152433.Lc6HmG.rst
M Modules/_winapi.c
diff --git
a/Misc/NEWS.d/next/Windows/2026-07-03-17-07-40.gh-issue-152433.Lc6HmG.rst
b/Misc/NEWS.d/next/Windows/2026-07-03-17-07-40.gh-issue-152433.Lc6HmG.rst
new file mode 100644
index 00000000000000..5f944e05b52567
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2026-07-03-17-07-40.gh-issue-152433.Lc6HmG.rst
@@ -0,0 +1 @@
+``_winapi`` module: improve UWP compatibility
diff --git a/Modules/_winapi.c b/Modules/_winapi.c
index 36eb831044a786..3cee151b997dee 100644
--- a/Modules/_winapi.c
+++ b/Modules/_winapi.c
@@ -1211,6 +1211,7 @@ gethandlelist(PyObject *mapping, const char *name,
Py_ssize_t *size)
return ret;
}
+#ifdef MS_WINDOWS_DESKTOP
typedef struct {
LPPROC_THREAD_ATTRIBUTE_LIST attribute_list;
LPHANDLE handle_list;
@@ -1322,6 +1323,7 @@ getattributelist(PyObject *obj, const char *name,
AttributeList *attribute_list)
return ret;
}
+#endif
/*[clinic input]
_winapi.CreateProcess
@@ -1355,6 +1357,9 @@ _winapi_CreateProcess_impl(PyObject *module, const
wchar_t *application_name,
PyObject *startup_info)
/*[clinic end generated code: output=a25c8e49ea1d6427 input=84e2175279a3f5c2]*/
{
+#ifndef MS_WINDOWS_DESKTOP
+ return NULL;
+#else
PyObject *ret = NULL;
BOOL result;
PROCESS_INFORMATION pi;
@@ -1436,6 +1441,7 @@ _winapi_CreateProcess_impl(PyObject *module, const
wchar_t *application_name,
freeattributelist(&attribute_list);
return ret;
+#endif
}
/*[clinic input]
@@ -2591,7 +2597,9 @@ _winapi_BatchedWaitForMultipleObjects_impl(PyObject
*module,
while (--thread_count >= 0) {
HANDLE t = thread_data[thread_count]->thread;
if (t) {
+#ifdef MS_WINDOWS_DESKTOP
TerminateThread(t, WAIT_ABANDONED_0);
+#endif
CloseHandle(t);
}
PyMem_Free((void *)thread_data[thread_count]);
@@ -2785,7 +2793,11 @@ static PyObject *
_winapi_GetOEMCP_impl(PyObject *module)
/*[clinic end generated code: output=4def5b07a8be1b3b input=e8caf4353a28e28e]*/
{
+#ifndef MS_WINDOWS_DESKTOP
+ return NULL;
+#else
return PyLong_FromUnsignedLong(GetOEMCP());
+#endif
}
/*[clinic input]
_______________________________________________
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]