Skip to content

Commit 6aca0ee

Browse files
authored
Fix invalid string preprocessing tokens for mingw (#2742)
1 parent 059e9d6 commit 6aca0ee

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def __init__(self, name, **kw):
279279
# Additional utility functions are only available for 32-bit builds.
280280
if not platform.machine() in ("AMD64", "ARM64"):
281281
libs += " version user32 advapi32 Ex2KSdk sadapi netapi32"
282-
kw["libraries"] = kw.get("libraries", "")
282+
kw["libraries"] = libs
283283
super().__init__(name, **kw)
284284

285285
def get_pywin32_dir(self):

win32/src/PyWinTypesmodule.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,10 +1034,10 @@ extern "C" __declspec(dllexport) BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwR
10341034
}
10351035

10361036
// Function to format a python traceback into a character string.
1037-
#define GPEM_ERROR(what) \
1038-
{ \
1039-
errorMsg = L"<Error getting traceback - "##what##">"; \
1040-
goto done; \
1037+
#define GPEM_ERROR(what) \
1038+
{ \
1039+
errorMsg = L"<Error getting traceback - " what ">"; \
1040+
goto done; \
10411041
}
10421042
PYWINTYPES_EXPORT WCHAR *GetPythonTraceback(PyObject *exc_type, PyObject *exc_value, PyObject *exc_tb)
10431043
{

win32/src/win32file_comm.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ PyDCB::PyDCB(const DCB &other)
162162

163163
PyDCB::~PyDCB(void) {}
164164

165-
#define GET_BITFIELD_ENTRY(bitfield_name) \
166-
else if (strcmp(name, #bitfield_name) == 0) \
167-
{ \
168-
return PyLong_FromLong(pydcb->m_DCB.##bitfield_name); \
165+
#define GET_BITFIELD_ENTRY(bitfield_name) \
166+
else if (strcmp(name, #bitfield_name) == 0) \
167+
{ \
168+
return PyLong_FromLong(pydcb->m_DCB.bitfield_name); \
169169
}
170170

171171
PyObject *PyDCB::getattro(PyObject *self, PyObject *obname)
@@ -201,7 +201,7 @@ PyObject *PyDCB::getattro(PyObject *self, PyObject *obname)
201201
PyErr_Format(PyExc_TypeError, szNeedIntAttr, #bitfield_name); \
202202
return -1; \
203203
} \
204-
pydcb->m_DCB.##bitfield_name = PyLong_AsLong(v); \
204+
pydcb->m_DCB.bitfield_name = PyLong_AsLong(v); \
205205
return 0; \
206206
}
207207

@@ -364,10 +364,10 @@ PyCOMSTAT::PyCOMSTAT(const COMSTAT &other)
364364
PyCOMSTAT::~PyCOMSTAT(void) {}
365365

366366
#undef GET_BITFIELD_ENTRY
367-
#define GET_BITFIELD_ENTRY(bitfield_name) \
368-
else if (strcmp(name, #bitfield_name) == 0) \
369-
{ \
370-
return PyLong_FromLong(pyCOMSTAT->m_COMSTAT.##bitfield_name); \
367+
#define GET_BITFIELD_ENTRY(bitfield_name) \
368+
else if (strcmp(name, #bitfield_name) == 0) \
369+
{ \
370+
return PyLong_FromLong(pyCOMSTAT->m_COMSTAT.bitfield_name); \
371371
}
372372

373373
PyObject *PyCOMSTAT::getattro(PyObject *self, PyObject *obname)
@@ -397,7 +397,7 @@ PyObject *PyCOMSTAT::getattro(PyObject *self, PyObject *obname)
397397
PyErr_Format(PyExc_TypeError, szNeedIntAttr, #bitfield_name); \
398398
return -1; \
399399
} \
400-
pyCOMSTAT->m_COMSTAT.##bitfield_name = PyLong_AsLong(v); \
400+
pyCOMSTAT->m_COMSTAT.bitfield_name = PyLong_AsLong(v); \
401401
return 0; \
402402
}
403403

win32/src/win32pdhmodule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ PDH_STATUS __stdcall PyCounterPathCallback(DWORD_PTR dwArg)
805805
{ \
806806
if (i < seqLen) { \
807807
PyObject *subItem = PyTuple_GET_ITEM(flags_tuple, i); \
808-
myCfg.cfg.##r = PyObject_IsTrue(subItem); \
808+
myCfg.cfg.r = PyObject_IsTrue(subItem); \
809809
} \
810810
}
811811

0 commit comments

Comments
 (0)