Skip to content

Commit 46fa9f3

Browse files
committed
gh-152433: Windows: _winapi module: improve UWP compatibility
1 parent 87120d3 commit 46fa9f3

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
@@ -1214,6 +1214,7 @@ gethandlelist(PyObject *mapping, const char *name, Py_ssize_t *size)
12141214
return ret;
12151215
}
12161216

1217+
#ifdef MS_WINDOWS_DESKTOP
12171218
typedef struct {
12181219
LPPROC_THREAD_ATTRIBUTE_LIST attribute_list;
12191220
LPHANDLE handle_list;
@@ -1325,6 +1326,7 @@ getattributelist(PyObject *obj, const char *name, AttributeList *attribute_list)
13251326

13261327
return ret;
13271328
}
1329+
#endif
13281330

13291331
/*[clinic input]
13301332
_winapi.CreateProcess
@@ -1358,6 +1360,9 @@ _winapi_CreateProcess_impl(PyObject *module, const wchar_t *application_name,
13581360
PyObject *startup_info)
13591361
/*[clinic end generated code: output=a25c8e49ea1d6427 input=42ac293eaea03fc4]*/
13601362
{
1363+
#ifndef MS_WINDOWS_DESKTOP
1364+
return NULL;
1365+
#else
13611366
PyObject *ret = NULL;
13621367
BOOL result;
13631368
PROCESS_INFORMATION pi;
@@ -1439,6 +1444,7 @@ _winapi_CreateProcess_impl(PyObject *module, const wchar_t *application_name,
14391444
freeattributelist(&attribute_list);
14401445

14411446
return ret;
1447+
#endif
14421448
}
14431449

14441450
/*[clinic input]
@@ -2582,7 +2588,9 @@ _winapi_BatchedWaitForMultipleObjects_impl(PyObject *module,
25822588
while (--thread_count >= 0) {
25832589
HANDLE t = thread_data[thread_count]->thread;
25842590
if (t) {
2591+
#ifdef MS_WINDOWS_DESKTOP
25852592
TerminateThread(t, WAIT_ABANDONED_0);
2593+
#endif
25862594
CloseHandle(t);
25872595
}
25882596
PyMem_Free((void *)thread_data[thread_count]);
@@ -2776,7 +2784,11 @@ static PyObject *
27762784
_winapi_GetOEMCP_impl(PyObject *module)
27772785
/*[clinic end generated code: output=4def5b07a8be1b3b input=e8caf4353a28e28e]*/
27782786
{
2787+
#ifndef MS_WINDOWS_DESKTOP
2788+
return NULL;
2789+
#else
27792790
return PyLong_FromUnsignedLong(GetOEMCP());
2791+
#endif
27802792
}
27812793

27822794
/*[clinic input]

0 commit comments

Comments
 (0)