Skip to content

Conversation

@vstinner
Copy link
Member

@vstinnervstinner commented Apr 4, 2020

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
Copy link
MemberAuthor

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

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.
@vstinnervstinner merged commit 38aefc5 into python:masterApr 6, 2020
@vstinnervstinner deleted the get_weakrefs branch April 6, 2020 12:14
@vstinner
Copy link
MemberAuthor

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

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@vstinner@pablogsal@the-knights-who-say-ni@bedevere-bot