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: PyType_SUPPORTS_WEAKREFS() becomes a regular function #30938

Merged
merged 1 commit into from Jan 27, 2022

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jan 27, 2022

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 performances.

https://bugs.python.org/issue40170

@vstinner
Copy link
Member Author

vstinner commented Jan 27, 2022

I cannot find "PyType_SUPPORTS_WEAKREFS" in the source code of top 5000 PyPI projects.

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 performances.
@vstinner vstinner marked this pull request as ready for review Jan 27, 2022
@vstinner
Copy link
Member Author

vstinner commented Jan 27, 2022

This change has no impact on performance (Python internals continue accessing directly the PyTypeObject) and no impact on the API (the function remains available in the public C API).

@vstinner vstinner merged commit af32b3e into python:main Jan 27, 2022
11 checks passed
@vstinner vstinner deleted the type_supports_weakref branch Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants