◐ Shell
clean mode source ↗

bpo-40170: PyObject_GET_WEAKREFS_LISTPTR() becomes a function by vstinner · Pull Request #19377 · python/cpython

Conversation

@vstinner

Convert PyObject_GET_WEAKREFS_LISTPTR() macro to a function to hide
implementation details: the macro accessed directly to
PyTypeObject.tp_weaklistoffset member.

https://bugs.python.org/issue40170

@vstinner

PyObject_GET_WEAKREFS_LISTPTR() is used in the garbage collector.

If converting the macro into a regular function caused a performance overhead, we can add an internal macro / static inline function for Python internals.

cc @pablogsal @pitrou

pablogsal

pablogsal

pablogsal

Convert the PyObject_GET_WEAKREFS_LISTPTR() macro to a function to
hide implementation details: the macro accessed directly to the
PyTypeObject.tp_weaklistoffset member.

Add _PyObject_GET_WEAKREFS_LISTPTR() static inline function to the
internal C API.

@vstinner

Thanks @pablogsal. I added a static inline function to the internal C API.