Skip to content

Commit ab4ee55

Browse files
authored
gh-152433: Windows: _ctypes module: improve UWP compatibility (#152792)
1 parent 1b1b9b3 commit ab4ee55

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Allow build :mod:`!_ctypes` for Universal Windows Platform.

Modules/_ctypes/callproc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,8 +1082,7 @@ void _ctypes_extend_error(PyObject *exc_class, const char *fmt, ...)
10821082
}
10831083

10841084

1085-
#ifdef MS_WIN32
1086-
1085+
#ifdef MS_WINDOWS_DESKTOP
10871086
static PyObject *
10881087
GetComError(ctypes_state *st, HRESULT errcode, GUID *riid, IUnknown *pIunk)
10891088
{
@@ -1337,9 +1336,11 @@ PyObject *_ctypes_callproc(ctypes_state *st,
13371336

13381337
#ifdef MS_WIN32
13391338
if (iid && pIunk) {
1339+
#ifdef MS_WINDOWS_DESKTOP
13401340
if (*(int *)resbuf & 0x80000000)
13411341
retval = GetComError(st, *(HRESULT *)resbuf, iid, pIunk);
13421342
else
1343+
#endif
13431344
retval = PyLong_FromLong(*(int *)resbuf);
13441345
} else if (flags & FUNCFLAG_HRESULT) {
13451346
if (*(int *)resbuf & 0x80000000)

0 commit comments

Comments
 (0)