Skip to content

Commit c477a14

Browse files
committed
Don't poison on clang
1 parent 38950b8 commit c477a14

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Include/pyabi.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@
7373
// Since users are free to the macro, and there's no way to undo the
7474
// poisoning at the end of Python.h, we only do this in a test module
7575
// (test_cext).
76-
# ifdef __GNUC__
76+
//
77+
// Clang's poisoning is stricter than GCC's: it looks in `#elif`
78+
// expressions after matching `#if`s. We disable it for now.
79+
// We also provide an undocumented, unsupported opt-out macro to help
80+
// porting to other compilers. Consider reaching out if you use it.
81+
# if defined(__GNUC__) && !defined(__clang__) && !defined(_Py_NO_GCC_POISON)
7782
# undef Py_GIL_DISABLED
7883
# pragma GCC poison Py_GIL_DISABLED
7984
# endif

0 commit comments

Comments
 (0)