Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d9d5b3d

Browse files
authored
gh-124344: Make _PyObject_IS_GC() use underscored PyType_IS_GC() (#124349)
move up _PyType_IS_GC and use it
1 parent 2e0d445 commit d9d5b3d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Include/internal/pycore_object.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -732,12 +732,15 @@ _PyObject_GET_WEAKREFS_LISTPTR_FROM_OFFSET(PyObject *op)
732732
return (PyWeakReference **)((char *)op + offset);
733733
}
734734

735+
// Fast inlined version of PyType_IS_GC()
736+
#define _PyType_IS_GC(t) _PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
737+
735738
// Fast inlined version of PyObject_IS_GC()
736739
static inline int
737740
_PyObject_IS_GC(PyObject *obj)
738741
{
739742
PyTypeObject *type = Py_TYPE(obj);
740-
return (PyType_IS_GC(type)
743+
return (_PyType_IS_GC(type)
741744
&& (type->tp_is_gc == NULL || type->tp_is_gc(obj)));
742745
}
743746

@@ -755,9 +758,6 @@ _PyObject_HashFast(PyObject *op)
755758
return PyObject_Hash(op);
756759
}
757760

758-
// Fast inlined version of PyType_IS_GC()
759-
#define _PyType_IS_GC(t) _PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
760-
761761
static inline size_t
762762
_PyType_PreHeaderSize(PyTypeObject *tp)
763763
{

0 commit comments

Comments
 (0)