Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-40170: PyObject_GET_WEAKREFS_LISTPTR() becomes a function #19377

Merged
merged 1 commit into from
Apr 6, 2020
Merged

bpo-40170: PyObject_GET_WEAKREFS_LISTPTR() becomes a function #19377

merged 1 commit into from
Apr 6, 2020

Conversation

vstinner
Copy link
Member

@vstinner vstinner 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
Member Author

vstinner commented Apr 5, 2020

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

vstinner commented Apr 6, 2020

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

Sign up for free to 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