From a9e9cfae1c3147d581bc99234b09b88a33324bfd Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 12 Feb 2023 13:22:16 +0100 Subject: [PATCH] py_panda: Fix definition of _PyErr_OCCURRED for Python >3.12.0a5 It should not be redefined for Python versions after 3.3.3, and if it's not defined by Python, it should just map to PyErr_Occurred() See also #1457 --- dtool/src/interrogatedb/py_compat.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dtool/src/interrogatedb/py_compat.h b/dtool/src/interrogatedb/py_compat.h index 35edfdec5a..c5474b21ee 100644 --- a/dtool/src/interrogatedb/py_compat.h +++ b/dtool/src/interrogatedb/py_compat.h @@ -127,8 +127,10 @@ typedef long Py_hash_t; #if PY_MAJOR_VERSION >= 3 // Python 3 versions before 3.3.3 defined this incorrectly. -# undef _PyErr_OCCURRED -# define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type) +# if PY_VERSION_HEX < 0x03030300 +# undef _PyErr_OCCURRED +# define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type) +# endif // Python versions before 3.3 did not define this. # if PY_VERSION_HEX < 0x03030000