Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/PythonQtPythonInclude.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,19 @@
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
#endif

// Avoid clashes with libstdc++ <locale> by undefining ctype macros
// that CPython may introduce on macOS when the UTF-8 ctype quirk is enabled.
// (_PY_PORT_CTYPE_UTF8_ISSUE is defined by CPython’s pyport.h; we apply these
// undefs only in C++ builds.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Searching for this reveals a number of similar issues in CPython itself, which they seem to have resolved by using the macros from pyctype.h like Py_ISALPHA etc.

#if defined(_PY_PORT_CTYPE_UTF8_ISSUE) && defined(__cplusplus)
#undef isalnum
#undef isalpha
#undef islower
#undef isspace
#undef isupper
#undef tolower
#undef toupper
#endif

#endif

Loading