mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.11] gh-92228: disable the compiler's 'small exit block inlining' optimization for blocks that have a line number (GH-94592) (GH-94643)
Inlining of code that corresponds to source code lines, can make it hard to distinguish later between code which is only reachable from except handlers, and that which is reachable in normal control flow. This caused problems with the debugger's jump feature.
This PR turns off the inlining optimisation for code which has line numbers. We still inline things like the implicit "return None"..
(cherry picked from commit bde06e1b83
)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
This commit is contained in:
parent
3517c138a8
commit
74c953d396
5 changed files with 34 additions and 10 deletions
|
@ -2042,6 +2042,15 @@ class JumpTestCase(unittest.TestCase):
|
|||
output.append(6)
|
||||
output.append(7)
|
||||
|
||||
@jump_test(6, 1, [1, 5, 1, 5])
|
||||
def test_jump_over_try_except(output):
|
||||
output.append(1)
|
||||
try:
|
||||
1 / 0
|
||||
except ZeroDivisionError as e:
|
||||
output.append(5)
|
||||
x = 42 # has to be a two-instruction block
|
||||
|
||||
@jump_test(2, 4, [1, 4, 5, -4])
|
||||
def test_jump_across_with(output):
|
||||
output.append(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue