-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-108732: include comprehension locals in frame.f_locals #109026
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
Conversation
Co-authored-by: Radislav Chugunov <[email protected]>
This failure is unrelated to this PR. Apparently, a test_asyncio test is unable on FreeBSD:
I created issue #109051 to track it. |
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 good apart from a suggestion in the NEWS entry.
Misc/NEWS.d/next/Core and Builtins/2023-09-06-13-28-42.gh-issue-108732.I6DkEQ.rst
Show resolved
Hide resolved
Misc/NEWS.d/next/Core and Builtins/2023-09-06-13-28-42.gh-issue-108732.I6DkEQ.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Jelle Zijlstra <[email protected]>
Thanks @carljm for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
…onGH-109026) (cherry picked from commit f2584ea) Co-authored-by: Carl Meyer <[email protected]> Co-authored-by: Radislav Chugunov <[email protected]> Co-authored-by: Jelle Zijlstra <[email protected]>
GH-109097 is a backport of this pull request to the 3.12 branch. |
…109026) (#109097) gh-108732: include comprehension locals in frame.f_locals (GH-109026) (cherry picked from commit f2584ea) Co-authored-by: Carl Meyer <[email protected]> Co-authored-by: Radislav Chugunov <[email protected]> Co-authored-by: Jelle Zijlstra <[email protected]>
|
|
This applies the same fix that was made for
locals()
in #105715 tosys._getframe().f_locals
as well. This is mostly relevant because pdb uses the latter, so this fix makes these comprehension locals (in module- or class-scope comprehensions) visible to pdb.I also made one small fix in passing to
PyFrame_FastToLocalsWithError
; the assertion and the null check were in the wrong order, since the assertion would segfault before ever hitting the null check, iff
were null. (Of course if assertions are turned off, the order doesn't matter either way.)frame.f_locals
for list/dict/set comprehension in module/class scope doesn't contain iteration variables #108732