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
This commit is contained in:
rdb 2023-02-12 13:22:16 +01:00
parent 173dd67b52
commit a9e9cfae1c

View File

@ -127,8 +127,10 @@ typedef long Py_hash_t;
#if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3
// Python 3 versions before 3.3.3 defined this incorrectly. // Python 3 versions before 3.3.3 defined this incorrectly.
# undef _PyErr_OCCURRED # if PY_VERSION_HEX < 0x03030300
# define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type) # undef _PyErr_OCCURRED
# define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type)
# endif
// Python versions before 3.3 did not define this. // Python versions before 3.3 did not define this.
# if PY_VERSION_HEX < 0x03030000 # if PY_VERSION_HEX < 0x03030000