You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C API] Build Python with -Wundef to detect typos in C macro names and detect undefined macros #162214
When using #ifdef MACRO or #if defined(MACRO), the C preprocessor ignores silently error if the MACRO is not defined. If there is a typo in the macro name, it's ignored silently.
I propose building Python with -Wundef (when it's supported by the C compiler) to detect usage of undefined macros.
See commit de9a4fb for a recent example of such issue: _Py_STDC_VERSION macro was used whereas the macro was unused. The change modified test_cext to build the C and C++ extensions with -Wundef.
Activity
vstinner commentedon Nov 18, 2026
See commit de9a4fb for a recent example of such issue:
_Py_STDC_VERSIONmacro was used whereas the macro was unused. The change modifiedtest_cextto build the C and C++ extensions with-Wundef.HACL_CAN_COMPILE_VEC128macro is not defined when building Python with-Wundef#162219pythongh-162214: Define TARGET_OS_OSX macro in Modules/_testcapi/mem.c
pythongh-162214: Avoid undefined macros in mimalloc
pythongh-162214: Avoid undefined macros in mimalloc
gh-162214: Test Py_GIL_DISABLED macro using #ifdef (#162223)
gh-162214: Test Py_STATS macro using #ifdef (#162225)
gh-162214: Use #ifdef to test USING_APPLE_OS_LIBFFI macro in ctypes.h (…
gh-162214: Define TARGET_OS_OSX macro in Modules/_testcapi/mem.c (#16…
gh-162214: Define STRINGLIB_IS_UNICODE macro in bytes_methods.c (#162222