-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
type-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
_PyObject_IS_GC()
is one of the most frequently used functions, which keeps using PyType_HasFeature()
rather than _PyType_HasFeature()
.
I know it has no performance issues since introduced, but switching to use _PyType_HasFeature()
would make more sense:
- Include/internal/pycore_object.h
// Fast inlined version of PyObject_IS_GC()
static inline int
_PyObject_IS_GC(PyObject *obj)
{
PyTypeObject *type = Py_TYPE(obj);
return (PyType_IS_GC(type)
&& (type->tp_is_gc == NULL || type->tp_is_gc(obj)));
}
...
// Fast inlined version of PyType_IS_GC()
#define _PyType_IS_GC(t) _PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
- Include/objimpl.h
/* Test if a type has a GC head */
#define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
cc @vstinner
Linked PRs
Metadata
Metadata
Assignees
Labels
type-featureA feature request or enhancementA feature request or enhancement