Skip to content

gh-93274: Make vectorcall safe on mutable classes #95437

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

Merged
merged 9 commits into from
Aug 4, 2022

Conversation

encukou
Copy link
Member

@encukou encukou commented Jul 29, 2022

Remove the Py_TPFLAGS_HAVE_VECTORCALL flag from a class when __call__ method is reassigned (directly on the class, or on a superclass if inherited).
This should make vectorcall safe to use with mutable types.

Make mutable types inherit Py_TPFLAGS_HAVE_VECTORCALL, if they do not override tp_call.

Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a couple of compiler warnings to fix, otherwise this looks like a safe change.

@encukou encukou merged commit 7b370b7 into python:main Aug 4, 2022
@encukou encukou deleted the vectorcall-reset branch August 4, 2022 15:19
@encukou
Copy link
Member Author

encukou commented Aug 4, 2022

Thank you for the review!

iritkatriel pushed a commit to iritkatriel/cpython that referenced this pull request Aug 11, 2022
@encukou
Copy link
Member Author

encukou commented Feb 3, 2023

#101497 is (essentially) a request to backport this feature.

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.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy