-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
gh-74929: Implement PEP 667 #115153
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
gh-74929: Implement PEP 667 #115153
Conversation
markshannon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for doing this.
I've a few comments, but nothing major.
|
Thanks for doing this! I was hoping this would get done for 3.13 but hadn't found time to do it yet.
EDIT: on second thought, I realized the problem is likely that |
Yes, that's why the test fails. The test is |
|
I cleaned up the code a bit to address the review and added the GC part in. This is still in draft state, which only aims to demostrate the possibility of PEP 667. There's plenty of work to be done before this can be merged in. The current goal is to make it enough for the PSF to decide whether to accept PEP 667. Let me know if there's still missing pieces (like do we want to actually remove all the FAST/LOCAL conversion calls to prove the point). |
|
Removing the fast locals <--> slow locals conversion is key to fixing #74929. I think that is worth doing before submitting PEP 667 to the SC. @gaogaotiantian since you are doing most of the work on this, would you like to be added as co-author of PEP 667? |
|
Sure, I'm happy to be listed as the co-author. I'll work on the fast vs local thing and check if #74929 is fixed. |
This is a prototype implementation of PEP 667.
All the examples given in PEP 667 passed.
The code only serves as a prototype, the proxy object is not even tracked by GC. However, the most essential features are implemented.
frame.f_localsis now a real-time proxy for the actual local variables in the frame (there's no mapping yet but that's an implementation detail).locals()behaves basically like before.All tests passed except for 3 - all expected
test_sysfor frame size - yes it changedtest_frame- Thepopmethod is not implemented yettest_listcomps- the behavior offrame.f_localschanged so the corresponding test is not valid anymore