diff --git a/Include/pyerrors.h b/Include/pyerrors.h index 14129d3533cbef..15a91408f293b6 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -47,11 +47,11 @@ PyAPI_FUNC(void) PyException_SetCause(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyException_GetContext(PyObject *); PyAPI_FUNC(void) PyException_SetContext(PyObject *, PyObject *); -/* */ - -#define PyExceptionClass_Check(x) \ - (PyType_Check((x)) && \ - PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS)) +static inline int _PyExceptionClass_Check(PyObject *exc) { + return (PyType_Check(exc) && + PyType_FastSubclass((PyTypeObject *)(exc), Py_TPFLAGS_BASE_EXC_SUBCLASS)); +} +#define PyExceptionClass_Check(exc) _PyExceptionClass_Check(_PyObject_CAST(exc)) #define PyExceptionInstance_Check(x) \ PyType_FastSubclass(Py_TYPE(x), Py_TPFLAGS_BASE_EXC_SUBCLASS)