From 4d59ad401488a2a8cfb013b3d0aeb46e4ee455df Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Wed, 8 Mar 2017 01:59:02 -0700 Subject: [PATCH] interrogatedb: Build even when _PyErr_OCCURRED is undefined --- dtool/src/interrogatedb/py_panda.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dtool/src/interrogatedb/py_panda.h b/dtool/src/interrogatedb/py_panda.h index f5e77e0dbb..d66ee88c21 100644 --- a/dtool/src/interrogatedb/py_panda.h +++ b/dtool/src/interrogatedb/py_panda.h @@ -303,8 +303,14 @@ template INLINE bool DTOOL_Call_ExtractThisPointer(PyObject *self, T *& // Functions related to error reporting. EXPCL_INTERROGATEDB bool _Dtool_CheckErrorOccurred(); +// _PyErr_OCCURRED is an undocumented macro version of PyErr_Occurred. +// Some implementations of the CPython API (e.g. PyPy's cpyext) do not define +// it, so in these cases we just silently fall back to PyErr_Occurred. +#ifndef _PyErr_OCCURRED +#define _PyErr_OCCURRED() PyErr_Occurred() +#endif + #ifdef NDEBUG -// _PyErr_OCCURRED is an undocumented inline version of PyErr_Occurred. #define Dtool_CheckErrorOccurred() (_PyErr_OCCURRED() != NULL) #else #define Dtool_CheckErrorOccurred() _Dtool_CheckErrorOccurred()