diff options
Diffstat (limited to 'Include')
-rw-r--r-- | Include/internal/pycore_object.h | 11 | ||||
-rw-r--r-- | Include/object.h | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h index 002b700..5c3d3ca 100644 --- a/Include/internal/pycore_object.h +++ b/Include/internal/pycore_object.h @@ -8,7 +8,7 @@ extern "C" { # error "this header requires Py_BUILD_CORE define" #endif -#include "pycore_pystate.h" /* _PyRuntime.gc */ +#include "pycore_pystate.h" /* PyInterpreterState.gc */ PyAPI_FUNC(int) _PyType_CheckConsistency(PyTypeObject *type); PyAPI_FUNC(int) _PyDict_CheckConsistency(PyObject *mp, int check_content); @@ -94,6 +94,15 @@ _PyObject_GET_WEAKREFS_LISTPTR(PyObject *op) return (PyObject **)((char *)op + offset); } +// Fast inlined version of PyType_HasFeature() +static inline int +_PyType_HasFeature(PyTypeObject *type, unsigned long feature) { + return ((type->tp_flags & feature) != 0); +} + +// Fast inlined version of PyType_IS_GC() +#define _PyType_IS_GC(t) _PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC) + #ifdef __cplusplus } #endif diff --git a/Include/object.h b/Include/object.h index 6b6c66a..564ba29 100644 --- a/Include/object.h +++ b/Include/object.h @@ -614,11 +614,7 @@ times. static inline int PyType_HasFeature(PyTypeObject *type, unsigned long feature) { -#ifdef Py_LIMITED_API return ((PyType_GetFlags(type) & feature) != 0); -#else - return ((type->tp_flags & feature) != 0); -#endif } #define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag) |