Skip to content
Prev Previous commit
Next Next commit
Don't poison on clang
  • Loading branch information
encukou committed Apr 17, 2026
commit c477a140a9f49e7fd8783397f7d5ebde043f4204
7 changes: 6 additions & 1 deletion Include/pyabi.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@
// Since users are free to the macro, and there's no way to undo the
// poisoning at the end of Python.h, we only do this in a test module
// (test_cext).
# ifdef __GNUC__
//
// Clang's poisoning is stricter than GCC's: it looks in `#elif`
// expressions after matching `#if`s. We disable it for now.
// We also provide an undocumented, unsupported opt-out macro to help
// porting to other compilers. Consider reaching out if you use it.
# if defined(__GNUC__) && !defined(__clang__) && !defined(_Py_NO_GCC_POISON)
# undef Py_GIL_DISABLED
# pragma GCC poison Py_GIL_DISABLED
# endif
Expand Down