https://github.com/python/cpython/commit/9b6a1a1abf3febbe7ce24dd6fc46c846e544a480 commit: 9b6a1a1abf3febbe7ce24dd6fc46c846e544a480 branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: encukou <[email protected]> date: 2026-10-28T14:56:04Z summary:
[3.15] gh-160704: Restore C11-C17 `static_assert` fallback (GH-160705) (GH-160825) gh-160704: Restore C11-C17 `static_assert` fallback (GH-160705) `_Py_STDC_VERSION` needs to be defined before its value can be checked. In 8335bcbf26b (gh-160208: Add a private wrapper around __STDC_VERSION__ (GH-160376), 2026-10-23), the condition `defined(_Py_STDC_VERSION)` is incorrectly negated, which prevents the fallback definition of `static_assert` in C11-C17 builds and causes a build error when building with an old C library that does not define `static_assert`. (cherry picked from commit a7ac7a8175ff64c2848f54644f5449ad44466a62) Signed-off-by: Ruoyu Zhong <[email protected]> Co-authored-by: Ruoyu Zhong <[email protected]> files: A Misc/NEWS.d/next/Build/2026-10-26-21-00-00.gh-issue-160704.ZRYLKF.rst M Include/pymacro.h diff --git a/Include/pymacro.h b/Include/pymacro.h index 29d20953235651b..5f1ee98dd3ff46c 100644 --- a/Include/pymacro.h +++ b/Include/pymacro.h @@ -25,7 +25,7 @@ // behaviour. So only define if building as C, not C++ (if __cplusplus is // not defined), and only for C11-17. #if !defined(static_assert) && (defined(__GNUC__) || defined(__clang__)) \ - && !defined(_Py_STDC_VERSION) \ + && defined(_Py_STDC_VERSION) \ && _Py_STDC_VERSION >= 201112L && _Py_STDC_VERSION <= 201710L # define static_assert _Static_assert #endif diff --git a/Misc/NEWS.d/next/Build/2026-10-26-21-00-00.gh-issue-160704.ZRYLKF.rst b/Misc/NEWS.d/next/Build/2026-10-26-21-00-00.gh-issue-160704.ZRYLKF.rst new file mode 100644 index 000000000000000..330415c155cd89a --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-10-26-21-00-00.gh-issue-160704.ZRYLKF.rst @@ -0,0 +1,2 @@ +Fix C11-C17 builds with old C library headers that do not define +``static_assert``, including glibc versions older than 2.16. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
