Commit 8056e58
fix(PythonQtPythonInclude): Undefine C <ctype> macros after Python.h to avoid libstdc++ <locale> clashes
On older Apple toolchains (e.g., macOS 10.7.4/Xcode 4.3.3 with libstdc++ 4.2.1),
including <Python.h> pulls in <ctype.h>, which defines macros like isspace/isalnum.
When C++ headers such as <locale> (transitively included by moc-generated code)
declare the templated overloads (e.g., `bool std::isspace(_CharT, const std::locale&)`),
those C macros expand and break compilation with errors.
In `PythonQtPythonInclude.h`, explicitly `#undef` the problematic <ctype.h> macros
(isalnum, isalpha, islower, isspace, isupper, tolower, toupper) after including Python
headers. This keeps macro pollution out of downstream C++ includes and lets the std:: functions/
overloads compile cleanly.
It fixes error like the following:
```
/usr/include/c++/4.2.1/bits/localefwd.h:57:21: error:
too many arguments provided to function-like macro invocation
isspace(_CharT, const locale&);
```
```
moc_PythonQtStdDecorators.cxx:152:25:
error: expected unqualified-id
case 4: _t->emit((*reinterpret_cast<
QObject*(*)>(_a[1])),(*reinterpret_cast< const
`
```
(cherry picked from commit commontk/PythonQt@4ce028d)1 parent d62d412 commit 8056e58
1 file changed
+23
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
145 | 167 | | |
| 168 | + | |
0 commit comments