]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-124344: Make `_PyObject_IS_GC()` use underscored `PyType_IS_GC()` (#124349)
authorneonene <53406459+neonene@users.noreply.github.com>
Mon, 23 Sep 2024 19:14:15 +0000 (04:14 +0900)
committerGitHub <noreply@github.com>
Mon, 23 Sep 2024 19:14:15 +0000 (21:14 +0200)
move up _PyType_IS_GC and use it

Include/internal/pycore_object.h

index 0d885b4630d2f0cc11d165c07102275e7b042ca4..80b588815bc9cfbbb7456e88a1f018cff05eb1b4 100644 (file)
@@ -732,12 +732,15 @@ _PyObject_GET_WEAKREFS_LISTPTR_FROM_OFFSET(PyObject *op)
     return (PyWeakReference **)((char *)op + offset);
 }
 
+// Fast inlined version of PyType_IS_GC()
+#define _PyType_IS_GC(t) _PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
+
 // 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)
+    return (_PyType_IS_GC(type)
             && (type->tp_is_gc == NULL || type->tp_is_gc(obj)));
 }
 
@@ -755,9 +758,6 @@ _PyObject_HashFast(PyObject *op)
     return PyObject_Hash(op);
 }
 
-// Fast inlined version of PyType_IS_GC()
-#define _PyType_IS_GC(t) _PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
-
 static inline size_t
 _PyType_PreHeaderSize(PyTypeObject *tp)
 {