Skip to content

Commit 4db8146

Browse files
committed
gh-152433: Windows: allow build overlapped.c for UWP
1 parent 66c76fa commit 4db8146

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Allow build ``overlapped.c`` for UWP.

Modules/overlapped.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535

3636
#define T_HANDLE T_POINTER
3737

38+
#ifndef HasOverlappedIoCompleted
39+
#define HasOverlappedIoCompleted(lpOverlapped) (lpOverlapped)->Internal != STATUS_PENDING
40+
#endif
41+
3842
/*[python input]
3943
class pointer_converter(CConverter):
4044
format_unit = '"F_POINTER"'
@@ -359,6 +363,9 @@ _overlapped_RegisterWaitWithQueue_impl(PyObject *module, HANDLE Object,
359363
DWORD Milliseconds)
360364
/*[clinic end generated code: output=c2ace732e447fe45 input=2dd4efee44abe8ee]*/
361365
{
366+
#ifndef MS_WINDOWS_DESKTOP
367+
return NULL;
368+
#else
362369
HANDLE NewWaitObject;
363370
struct PostCallbackData data = {CompletionPort, Overlapped}, *pdata;
364371

@@ -381,6 +388,7 @@ _overlapped_RegisterWaitWithQueue_impl(PyObject *module, HANDLE Object,
381388
}
382389

383390
return Py_BuildValue(F_HANDLE, NewWaitObject);
391+
#endif
384392
}
385393

386394
/*[clinic input]
@@ -396,6 +404,9 @@ static PyObject *
396404
_overlapped_UnregisterWait_impl(PyObject *module, HANDLE WaitHandle)
397405
/*[clinic end generated code: output=ec90cd955a9a617d input=a56709544cb2df0f]*/
398406
{
407+
#ifndef MS_WINDOWS_DESKTOP
408+
Py_RETURN_NONE;
409+
#else
399410
BOOL ret;
400411

401412
Py_BEGIN_ALLOW_THREADS
@@ -405,6 +416,7 @@ _overlapped_UnregisterWait_impl(PyObject *module, HANDLE WaitHandle)
405416
if (!ret)
406417
return SetFromWindowsErr(0);
407418
Py_RETURN_NONE;
419+
#endif
408420
}
409421

410422
/*[clinic input]
@@ -422,6 +434,9 @@ _overlapped_UnregisterWaitEx_impl(PyObject *module, HANDLE WaitHandle,
422434
HANDLE Event)
423435
/*[clinic end generated code: output=2e3d84c1d5f65b92 input=953cddc1de50fab9]*/
424436
{
437+
#ifndef MS_WINDOWS_DESKTOP
438+
Py_RETURN_NONE;
439+
#else
425440
BOOL ret;
426441

427442
Py_BEGIN_ALLOW_THREADS
@@ -431,6 +446,7 @@ _overlapped_UnregisterWaitEx_impl(PyObject *module, HANDLE WaitHandle,
431446
if (!ret)
432447
return SetFromWindowsErr(0);
433448
Py_RETURN_NONE;
449+
#endif
434450
}
435451

436452
/*

0 commit comments

Comments
 (0)