diff options
author | Victor Stinner <vstinner@python.org> | 2022-01-27 02:00:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-27 02:00:55 (GMT) |
commit | af32b3ef1fbad3c2242627a14398320960a0cb45 (patch) | |
tree | 350016f513e2ebbdae51ee1e033f668dc2d3f609 /Objects/weakrefobject.c | |
parent | f0a648152f2d8011f47cc49873438ebaf01d3f82 (diff) | |
download | cpython-af32b3ef1fbad3c2242627a14398320960a0cb45.zip cpython-af32b3ef1fbad3c2242627a14398320960a0cb45.tar.gz cpython-af32b3ef1fbad3c2242627a14398320960a0cb45.tar.bz2 |
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 'Objects/weakrefobject.c')
-rw-r--r-- | Objects/weakrefobject.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c index b992040..76121f9 100644 --- a/Objects/weakrefobject.c +++ b/Objects/weakrefobject.c @@ -299,7 +299,7 @@ weakref___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs) PyWeakReference *ref, *proxy; PyWeakReference **list; - if (!PyType_SUPPORTS_WEAKREFS(Py_TYPE(ob))) { + if (!_PyType_SUPPORTS_WEAKREFS(Py_TYPE(ob))) { PyErr_Format(PyExc_TypeError, "cannot create weak reference to '%s' object", Py_TYPE(ob)->tp_name); @@ -794,7 +794,7 @@ PyWeakref_NewRef(PyObject *ob, PyObject *callback) PyWeakReference **list; PyWeakReference *ref, *proxy; - if (!PyType_SUPPORTS_WEAKREFS(Py_TYPE(ob))) { + if (!_PyType_SUPPORTS_WEAKREFS(Py_TYPE(ob))) { PyErr_Format(PyExc_TypeError, "cannot create weak reference to '%s' object", Py_TYPE(ob)->tp_name); @@ -853,7 +853,7 @@ PyWeakref_NewProxy(PyObject *ob, PyObject *callback) PyWeakReference **list; PyWeakReference *ref, *proxy; - if (!PyType_SUPPORTS_WEAKREFS(Py_TYPE(ob))) { + if (!_PyType_SUPPORTS_WEAKREFS(Py_TYPE(ob))) { PyErr_Format(PyExc_TypeError, "cannot create weak reference to '%s' object", Py_TYPE(ob)->tp_name); @@ -949,7 +949,7 @@ PyObject_ClearWeakRefs(PyObject *object) PyWeakReference **list; if (object == NULL - || !PyType_SUPPORTS_WEAKREFS(Py_TYPE(object)) + || !_PyType_SUPPORTS_WEAKREFS(Py_TYPE(object)) || Py_REFCNT(object) != 0) { PyErr_BadInternalCall(); |