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
line number for a return in a with block after 3.10 is that of the with, not the return statement #93975
Labels
3.10
3.11
3.12
interpreter-core
Interpreter core (Objects, Python, Grammar, and Parser dirs)
type-bug
An unexpected behavior, bug, or error
Comments
The issue was introduced in 937cebc The same behaviour occurs with try-finally blocks on both 3.9 and 3.10+ def function():
try:
return
finally:
pass With the above code, disassembling on Python 3.10.5 produces the following 1 0 LOAD_CONST 0 (<code object function at 0x7f96b4e0d000, file "a.py", line 1>)
2 LOAD_CONST 1 ('function')
4 MAKE_FUNCTION 0
6 STORE_NAME 0 (function)
8 LOAD_CONST 2 (None)
10 RETURN_VALUE
Disassembly of <code object function at 0x7f96b4e0d000, file "tryfinally.py", line 1>:
2 0 SETUP_FINALLY 3 (to 8)
3 2 POP_BLOCK
5 4 LOAD_CONST 0 (None)
6 RETURN_VALUE
>> 8 RERAISE 0 And on 3.9.0 1 0 LOAD_CONST 0 (<code object function at 0x7f72158a8be0, file "/tmp/a.py", line 1>)
2 LOAD_CONST 1 ('function')
4 MAKE_FUNCTION 0
6 STORE_NAME 0 (function)
8 LOAD_CONST 2 (None)
10 RETURN_VALUE
Disassembly of <code object function at 0x7f72158a8be0, file "tryfinally.py", line 1>:
2 0 SETUP_FINALLY 6 (to 8)
3 2 POP_BLOCK
4 LOAD_CONST 0 (None)
6 RETURN_VALUE
5 >> 8 RERAISE
10 LOAD_CONST 0 (None)
12 RETURN_VALUE |
miss-islington
pushed a commit
that referenced
this issue
Jun 18, 2022
- gh-93957: Provide nicer error reporting from subprocesses in test_venv.EnsurePipTest.test_with_pip. - Update changelog This change does three things: 1. Extract a function for trapping output in subprocesses. 2. Emit both stdout and stderr when encountering an error. 3. Apply the change to `ensurepip._uninstall` check.
jaraco
added a commit
that referenced
this issue
Jun 19, 2022
- gh-93957: Provide nicer error reporting from subprocesses in test_venv.EnsurePipTest.test_with_pip. - Update changelog This change does three things: 1. Extract a function for trapping output in subprocesses. 2. Emit both stdout and stderr when encountering an error. 3. Apply the change to `ensurepip._uninstall` check. (cherry picked from commit 6066f45) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
jaraco
added a commit
that referenced
this issue
Jun 19, 2022
- gh-93957: Provide nicer error reporting from subprocesses in test_venv.EnsurePipTest.test_with_pip. - Update changelog This change does three things: 1. Extract a function for trapping output in subprocesses. 2. Emit both stdout and stderr when encountering an error. 3. Apply the change to `ensurepip._uninstall` check.. (cherry picked from commit 6066f45) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
jaraco
added a commit
that referenced
this issue
Jun 19, 2022
- gh-93957: Provide nicer error reporting from subprocesses in test_venv.EnsurePipTest.test_with_pip. - Update changelog This change does three things: 1. Extract a function for trapping output in subprocesses. 2. Emit both stdout and stderr when encountering an error. 3. Apply the change to `ensurepip._uninstall` check.. (cherry picked from commit 6066f45) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3.10
3.11
3.12
interpreter-core
Interpreter core (Objects, Python, Grammar, and Parser dirs)
type-bug
An unexpected behavior, bug, or error
In Python 3.10 onwards, the reported line number for the
return
statement is incorrect.Python main 3.12-main-ish not far from 3.11:
The only thing attributed to line 3 is a NOP. The RETURN_VALUE of 'b' is listed as line 2. That is wrong.
Python 3.9:
Noticed by @martindemello working on a 3.10 error attribution bug in pytype.
The text was updated successfully, but these errors were encountered: