@@ -207,10 +207,6 @@ PyAPI_DATA(struct _typeobject) PySuper_Type; /* built-in 'super' */
207207
208208PyAPI_FUNC (unsigned long ) PyType_GetFlags (struct _typeobject * );
209209
210- #define PyType_Check (op ) \
211- PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS)
212- #define PyType_CheckExact (op ) (Py_TYPE(op) == &PyType_Type)
213-
214210PyAPI_FUNC (int ) PyType_Ready (struct _typeobject * );
215211PyAPI_FUNC (PyObject * ) PyType_GenericAlloc (struct _typeobject * , Py_ssize_t );
216212PyAPI_FUNC (PyObject * ) PyType_GenericNew (struct _typeobject * ,
@@ -342,11 +338,6 @@ given type object has a specified feature.
342338/* Type structure has tp_finalize member (3.4) */
343339#define Py_TPFLAGS_HAVE_FINALIZE (1UL << 0)
344340
345- #ifdef Py_LIMITED_API
346- # define PyType_HasFeature (t ,f ) ((PyType_GetFlags(t) & (f)) != 0)
347- #endif
348- #define PyType_FastSubclass (t ,f ) PyType_HasFeature(t,f)
349-
350341
351342/*
352343The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement
@@ -600,6 +591,28 @@ times.
600591# undef Py_CPYTHON_OBJECT_H
601592#endif
602593
594+
595+ static inline int
596+ PyType_HasFeature (PyTypeObject * type , unsigned long feature ) {
597+ #ifdef Py_LIMITED_API
598+ return ((PyType_GetFlags (type ) & feature ) != 0 );
599+ #else
600+ return ((type -> tp_flags & feature ) != 0 );
601+ #endif
602+ }
603+
604+ #define PyType_FastSubclass (type , flag ) PyType_HasFeature(type, flag)
605+
606+ static inline int _PyType_Check (PyObject * op ) {
607+ return PyType_FastSubclass (Py_TYPE (op ), Py_TPFLAGS_TYPE_SUBCLASS );
608+ }
609+ #define PyType_Check (op ) _PyType_Check(_PyObject_CAST(op))
610+
611+ static inline int _PyType_CheckExact (PyObject * op ) {
612+ return (Py_TYPE (op ) == & PyType_Type );
613+ }
614+ #define PyType_CheckExact (op ) _PyType_CheckExact(_PyObject_CAST(op))
615+
603616#ifdef __cplusplus
604617}
605618#endif
0 commit comments