Repository navigation
Commit 2363a51
committed
gh-154643: Only use _Py_STDC_VERSION when defined
This fixes:
$ g++ -I/usr/include/python3.15 -c -Werror=undef test.cpp
In file included from /usr/include/python3.15/Python.h:68,
from test.cpp:1:
/usr/include/python3.15/pyport.h:494:9: error: ‘_Py_STDC_VERSION’ is not defined, evaluates to ‘0’ [-Werror=undef]
494 | # elif _Py_STDC_VERSION >= 201112L && !defined(__STDC_NO_THREADS__)
| ^~~~~~~~~~~~~~~~
cc1plus: some warnings being treated as errors
For any test.cpp that has #include <Python.h>.
For locating the place for the added test, I used LLM.
The main issue I could reproduce was in Include/pyport.h.
Include/cpython/pyatomic.h was updated for completeness.
Include/internal/mimalloc/mimalloc/atomic.h also has this
for __STDC_VERSION__
but was left untouched as it is code from a bundled project
and is likely not exposed publicly.
Assisted-By: Claude Opus 4.61 parent 7e5227f commit 2363a51
4 files changed
Lines changed: 9 additions & 2 deletions
File tree
- Include
- cpython
- Lib/test/test_cext
- Misc/NEWS.d/next/C_API
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
585 | 585 | | |
586 | 586 | | |
587 | 587 | | |
588 | | - | |
| 588 | + | |
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | | - | |
| 494 | + | |
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
177 | 182 | | |
178 | 183 | | |
179 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
0 commit comments