https://github.com/python/cpython/commit/d9d5b3d2ef770224b39987dbce7bb5c616fe3477
commit: d9d5b3d2ef770224b39987dbce7bb5c616fe3477
branch: main
author: neonene <[email protected]>
committer: vstinner <[email protected]>
date: 2024-09-23T21:14:15+02:00
summary:
gh-124344: Make `_PyObject_IS_GC()` use underscored `PyType_IS_GC()` (#124349)
move up _PyType_IS_GC and use it
files:
M Include/internal/pycore_object.h
diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h
index 0d885b4630d2f0..80b588815bc9cf 100644
--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -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)
{
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]