Browse Source

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
rdb 2 years ago
parent
commit
a9e9cfae1c
1 changed files with 4 additions and 2 deletions
  1. 4 2
      dtool/src/interrogatedb/py_compat.h

+ 4 - 2
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