summaryrefslogtreecommitdiff
path: root/Include/cpython/objimpl.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-01-27 03:00:55 +0100
committerGitHub <noreply@github.com>2022-01-27 03:00:55 +0100
commitaf32b3ef1fbad3c2242627a14398320960a0cb45 (patch)
tree350016f513e2ebbdae51ee1e033f668dc2d3f609 /Include/cpython/objimpl.h
parentf0a648152f2d8011f47cc49873438ebaf01d3f82 (diff)
downloadcpython-git-af32b3ef1fbad3c2242627a14398320960a0cb45.tar.gz
bpo-40170: PyType_SUPPORTS_WEAKREFS() becomes a regular function (GH-30938)
Convert the PyType_SUPPORTS_WEAKREFS() macro to a regular function. It no longer access the PyTypeObject.tp_weaklistoffset member directly. Add _PyType_SUPPORTS_WEAKREFS() static inline functions, used internally by Python for best performance.
Diffstat (limited to 'Include/cpython/objimpl.h')
-rw-r--r--Include/cpython/objimpl.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/Include/cpython/objimpl.h b/Include/cpython/objimpl.h
index 4a905c25cc..7fff96e8eb 100644
--- a/Include/cpython/objimpl.h
+++ b/Include/cpython/objimpl.h
@@ -91,7 +91,7 @@ PyAPI_FUNC(int) PyObject_IS_GC(PyObject *obj);
#endif
-/* Test if a type supports weak references */
-#define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0)
+// Test if a type supports weak references
+PyAPI_FUNC(int) PyType_SUPPORTS_WEAKREFS(PyTypeObject *type);
PyAPI_FUNC(PyObject **) PyObject_GET_WEAKREFS_LISTPTR(PyObject *op);