From 59728b7232d24f9411bdbf634fa676e9514a9cee Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Mon, 17 Feb 2025 19:40:07 +0100 Subject: [PATCH] pythoncapi_compat: don't define Py_NULL if it is already defined --- mypyc/lib-rt/pythoncapi_compat.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mypyc/lib-rt/pythoncapi_compat.h b/mypyc/lib-rt/pythoncapi_compat.h index e534c1cbb7cc..f94e50a3479f 100644 --- a/mypyc/lib-rt/pythoncapi_compat.h +++ b/mypyc/lib-rt/pythoncapi_compat.h @@ -34,6 +34,7 @@ extern "C" { # define _Py_CAST(type, expr) ((type)(expr)) #endif +#ifndef _Py_NULL // Static inline functions should use _Py_NULL rather than using directly NULL // to prevent C++ compiler warnings. On C23 and newer and on C++11 and newer, // _Py_NULL is defined as nullptr. @@ -43,6 +44,7 @@ extern "C" { #else # define _Py_NULL NULL #endif +#endif // Cast argument to PyObject* type. #ifndef _PyObject_CAST