summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_object.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/internal/pycore_object.h')
-rw-r--r--Include/internal/pycore_object.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h
index 7c0f24a..32e86d0 100644
--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -102,6 +102,15 @@ _PyType_HasFeature(PyTypeObject *type, unsigned long feature) {
return ((type->tp_flags & feature) != 0);
}
+// Fast inlined version of PyObject_IS_GC()
+static inline int
+_PyObject_IS_GC(PyObject *obj)
+{
+ return (PyType_IS_GC(Py_TYPE(obj))
+ && (Py_TYPE(obj)->tp_is_gc == NULL
+ || Py_TYPE(obj)->tp_is_gc(obj)));
+}
+
// Fast inlined version of PyType_IS_GC()
#define _PyType_IS_GC(t) _PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)