Skip to content

Commit 07f33ce

Browse files
authored
gh-152433: Windows: _winapi module: improve UWP compatibility (#152962)
1 parent ab4ee55 commit 07f33ce

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
``_winapi`` module: improve UWP compatibility

Modules/_winapi.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,7 @@ gethandlelist(PyObject *mapping, const char *name, Py_ssize_t *size)
12111211
return ret;
12121212
}
12131213

1214+
#ifdef MS_WINDOWS_DESKTOP
12141215
typedef struct {
12151216
LPPROC_THREAD_ATTRIBUTE_LIST attribute_list;
12161217
LPHANDLE handle_list;
@@ -1322,6 +1323,7 @@ getattributelist(PyObject *obj, const char *name, AttributeList *attribute_list)
13221323

13231324
return ret;
13241325
}
1326+
#endif
13251327

13261328
/*[clinic input]
13271329
_winapi.CreateProcess
@@ -1355,6 +1357,9 @@ _winapi_CreateProcess_impl(PyObject *module, const wchar_t *application_name,
13551357
PyObject *startup_info)
13561358
/*[clinic end generated code: output=a25c8e49ea1d6427 input=84e2175279a3f5c2]*/
13571359
{
1360+
#ifndef MS_WINDOWS_DESKTOP
1361+
return NULL;
1362+
#else
13581363
PyObject *ret = NULL;
13591364
BOOL result;
13601365
PROCESS_INFORMATION pi;
@@ -1436,6 +1441,7 @@ _winapi_CreateProcess_impl(PyObject *module, const wchar_t *application_name,
14361441
freeattributelist(&attribute_list);
14371442

14381443
return ret;
1444+
#endif
14391445
}
14401446

14411447
/*[clinic input]
@@ -2591,7 +2597,9 @@ _winapi_BatchedWaitForMultipleObjects_impl(PyObject *module,
25912597
while (--thread_count >= 0) {
25922598
HANDLE t = thread_data[thread_count]->thread;
25932599
if (t) {
2600+
#ifdef MS_WINDOWS_DESKTOP
25942601
TerminateThread(t, WAIT_ABANDONED_0);
2602+
#endif
25952603
CloseHandle(t);
25962604
}
25972605
PyMem_Free((void *)thread_data[thread_count]);
@@ -2785,7 +2793,11 @@ static PyObject *
27852793
_winapi_GetOEMCP_impl(PyObject *module)
27862794
/*[clinic end generated code: output=4def5b07a8be1b3b input=e8caf4353a28e28e]*/
27872795
{
2796+
#ifndef MS_WINDOWS_DESKTOP
2797+
return NULL;
2798+
#else
27882799
return PyLong_FromUnsignedLong(GetOEMCP());
2800+
#endif
27892801
}
27902802

27912803
/*[clinic input]

0 commit comments

Comments
 (0)