-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
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
[3.12] gh-130809: Fix PyFrame_LocalsToFast
copying the wrong value
#130816
base: 3.12
Are you sure you want to change the base?
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Not sure about the best place to test this. But validated the issue no longer reproduces, and Edit: well I thought they passed... will take a look at the peephole test. |
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.
See @gaogaotiantian's comment in the issue.
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
PyFrame_LocalsToFast
copying the wrong valuePyFrame_LocalsToFast
copying the wrong value
I took a second look at the fix and I think it's reasonable. However, the test itself is actually a bit misleading because that's just a symptom fixed with this PR - there are a few reason why that worked that way. As we already removed this system after 3.13, we don't need any regression test in the future. This would be the last bug fix version of 3.12, so even for 3.12 the test would not be helpful. Based on the misleading nature of the test, I would suggest that we simply remove the test. If others have different opinions, we can replace it with a more direct test. |
Misc/NEWS.d/next/Core_and_Builtins/2025-03-04-12-52-21.gh-issue-130809.fSXq60.rst
Outdated
Show resolved
Hide resolved
Is it possible to have a small but direct test? even if 3.12 has its last bug fix, it can still accept security patches and if, for some reasons (agreed I'm playing the Devil's advocate here), those security patches affected in some way or another the test, it would still be useful to have that test. I'm really stressing here that the test should be small, namely few lines. It doesn't hurt to test more unless testing more ends up with a larger and convoluted test. |
I think a test like import sys
frame = sys._getframe()
f_locals = frame.f_locals
foo = None
[foo for foo in [0]]
from abc import *
assert frame.f_locals is f_locals could work - it confirms |
Maybe @carljm can take a quick look at this? I know Carl has been busy recently but hopefully the explanation in #130809 (comment) helps. The code fix itself is also trivial. |
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.
Looks fine to me; thank you!
…e-130809.fSXq60.rst Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
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.
Please take a look at the comment about this test :)
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Updated, thank you! |
Hmm, you can't simply assert this in the test case (my code was more like a gist). One thing you could do is Also this definitely needs some comment to explain what happened. You could follow the patterns on the other test cases in the same file. I would suggest add For comments put something like
|
Obligatory ping @Yhg1s. The final 3.12 bugfix is coming up, and this is a somewhat risky change to include. |
Yeah I agree we should probably involve the release manager of 3.12. |
Don't update hidden fast locals in
PyFrame_LocalsToFast
, to make sure we don't write the wrong value if there is a name collision.PyFrame_LocalsToFast
misbehaving when there is a comprehension with colliding local variable #130809