mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
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.
This commit is contained in:
parent
f0a648152f
commit
af32b3ef1f
7 changed files with 24 additions and 10 deletions
|
|
@ -28,7 +28,7 @@ _weakref_getweakrefcount_impl(PyObject *module, PyObject *object)
|
|||
{
|
||||
PyWeakReference **list;
|
||||
|
||||
if (!PyType_SUPPORTS_WEAKREFS(Py_TYPE(object)))
|
||||
if (!_PyType_SUPPORTS_WEAKREFS(Py_TYPE(object)))
|
||||
return 0;
|
||||
|
||||
list = GET_WEAKREFS_LISTPTR(object);
|
||||
|
|
@ -85,7 +85,7 @@ weakref_getweakrefs(PyObject *self, PyObject *object)
|
|||
{
|
||||
PyObject *result = NULL;
|
||||
|
||||
if (PyType_SUPPORTS_WEAKREFS(Py_TYPE(object))) {
|
||||
if (_PyType_SUPPORTS_WEAKREFS(Py_TYPE(object))) {
|
||||
PyWeakReference **list = GET_WEAKREFS_LISTPTR(object);
|
||||
Py_ssize_t count = _PyWeakref_GetWeakrefCount(*list);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue