Skip to content

Commit 0808624

Browse files
authored
pythoncapi_compat: don't define Py_NULL if it is already defined (python#18699)
Fixes: python#18698 This is a naive fix for the gcc 15 error when compiling for Python 3.12
1 parent 5202c98 commit 0808624

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mypyc/lib-rt/pythoncapi_compat.h

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ extern "C" {
3434
# define _Py_CAST(type, expr) ((type)(expr))
3535
#endif
3636

37+
#ifndef _Py_NULL
3738
// Static inline functions should use _Py_NULL rather than using directly NULL
3839
// to prevent C++ compiler warnings. On C23 and newer and on C++11 and newer,
3940
// _Py_NULL is defined as nullptr.
@@ -43,6 +44,7 @@ extern "C" {
4344
#else
4445
# define _Py_NULL NULL
4546
#endif
47+
#endif
4648

4749
// Cast argument to PyObject* type.
4850
#ifndef _PyObject_CAST

0 commit comments

Comments
 (0)