-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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-98442: fix locations of with statement's cleanup instructions #120763
Conversation
|
||
# Expect three load None instructions for the no-exception __exit__ call, | ||
# and one RETURN_VALUE. | ||
# They should all have the locations of the context manager ('xyz'). |
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.
Why doesn't the RETURN_VALUE have the location of the return statement?
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.
The calculation of the value has that location. The return itself occurs after the exit, so it gets the location of the exit (the last instruction executed before the return).
Thanks @iritkatriel for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
pythonGH-120763) (cherry picked from commit 55596ae) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> pythongh-98442: fix location of with statement's cleanup instructions
GH-120786 is a backport of this pull request to the 3.13 branch. |
pythonGH-120763) (cherry picked from commit 55596ae) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> pythongh-98442: fix location of with statement's cleanup instructions
GH-120787 is a backport of this pull request to the 3.12 branch. |
python#120763) pythongh-98442: fix location of with statement's cleanup instructions
python#120763) pythongh-98442: fix location of with statement's cleanup instructions
python#120763) pythongh-98442: fix location of with statement's cleanup instructions
Fixes #98442.