Skip to content

Commit 9ab9181

Browse files
authored
gh-152433: Windows: allow build overlapped.c for UWP (#153036)
1 parent 392ad7e commit 9ab9181

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 :mod:`!_overlapped` module for Universal Windows Platform.

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"'
@@ -351,6 +355,9 @@ _overlapped_RegisterWaitWithQueue_impl(PyObject *module, HANDLE Object,
351355
DWORD Milliseconds)
352356
/*[clinic end generated code: output=c2ace732e447fe45 input=2dd4efee44abe8ee]*/
353357
{
358+
#ifndef MS_WINDOWS_DESKTOP
359+
return NULL;
360+
#else
354361
HANDLE NewWaitObject;
355362
struct PostCallbackData data = {CompletionPort, Overlapped}, *pdata;
356363

@@ -373,6 +380,7 @@ _overlapped_RegisterWaitWithQueue_impl(PyObject *module, HANDLE Object,
373380
}
374381

375382
return Py_BuildValue(F_HANDLE, NewWaitObject);
383+
#endif
376384
}
377385

378386
/*[clinic input]
@@ -388,6 +396,9 @@ static PyObject *
388396
_overlapped_UnregisterWait_impl(PyObject *module, HANDLE WaitHandle)
389397
/*[clinic end generated code: output=ec90cd955a9a617d input=a56709544cb2df0f]*/
390398
{
399+
#ifndef MS_WINDOWS_DESKTOP
400+
Py_RETURN_NONE;
401+
#else
391402
BOOL ret;
392403

393404
Py_BEGIN_ALLOW_THREADS
@@ -397,6 +408,7 @@ _overlapped_UnregisterWait_impl(PyObject *module, HANDLE WaitHandle)
397408
if (!ret)
398409
return SetFromWindowsErr(0);
399410
Py_RETURN_NONE;
411+
#endif
400412
}
401413

402414
/*[clinic input]
@@ -414,6 +426,9 @@ _overlapped_UnregisterWaitEx_impl(PyObject *module, HANDLE WaitHandle,
414426
HANDLE Event)
415427
/*[clinic end generated code: output=2e3d84c1d5f65b92 input=953cddc1de50fab9]*/
416428
{
429+
#ifndef MS_WINDOWS_DESKTOP
430+
Py_RETURN_NONE;
431+
#else
417432
BOOL ret;
418433

419434
Py_BEGIN_ALLOW_THREADS
@@ -423,6 +438,7 @@ _overlapped_UnregisterWaitEx_impl(PyObject *module, HANDLE WaitHandle,
423438
if (!ret)
424439
return SetFromWindowsErr(0);
425440
Py_RETURN_NONE;
441+
#endif
426442
}
427443

428444
/*

0 commit comments

Comments
 (0)