diff --git a/Include/pymacro.h b/Include/pymacro.h index 73521be00fcd1ad..f08ed1a1ecf0f9f 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.