diff options
| author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2022-07-07 06:38:36 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-07 06:38:36 (GMT) |
| commit | bde06e1b8381f140b296a397ddd1deb1c784ff8e (patch) | |
| tree | 7ff63df7d55741dae98638e14e691f6ccdf5bf4d /Lib/test/test_dis.py | |
| parent | 94988603f3c934f95220f09aefffd50c0a5d3367 (diff) | |
| download | cpython-bde06e1b8381f140b296a397ddd1deb1c784ff8e.zip cpython-bde06e1b8381f140b296a397ddd1deb1c784ff8e.tar.gz cpython-bde06e1b8381f140b296a397ddd1deb1c784ff8e.tar.bz2 | |
gh-92228: disable the compiler's 'small exit block inlining' optimization for blocks that have a line number (GH-94592)
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".
Diffstat (limited to 'Lib/test/test_dis.py')
| -rw-r--r-- | Lib/test/test_dis.py | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index 2560048..440e4ed 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -360,13 +360,13 @@ dis_traceback = """\ --> BINARY_OP 11 (/) POP_TOP -%3d LOAD_FAST_CHECK 1 (tb) +%3d >> LOAD_FAST_CHECK 1 (tb) RETURN_VALUE >> PUSH_EXC_INFO %3d LOAD_GLOBAL 0 (Exception) CHECK_EXC_MATCH - POP_JUMP_FORWARD_IF_FALSE 23 (to 82) + POP_JUMP_FORWARD_IF_FALSE 22 (to 80) STORE_FAST 0 (e) %3d LOAD_FAST 0 (e) @@ -376,9 +376,7 @@ dis_traceback = """\ LOAD_CONST 0 (None) STORE_FAST 0 (e) DELETE_FAST 0 (e) - -%3d LOAD_FAST 1 (tb) - RETURN_VALUE + JUMP_BACKWARD 29 (to 14) >> LOAD_CONST 0 (None) STORE_FAST 0 (e) DELETE_FAST 0 (e) @@ -396,7 +394,6 @@ ExceptionTable: TRACEBACK_CODE.co_firstlineno + 5, TRACEBACK_CODE.co_firstlineno + 3, TRACEBACK_CODE.co_firstlineno + 4, - TRACEBACK_CODE.co_firstlineno + 5, TRACEBACK_CODE.co_firstlineno + 3) def _fstring(a, b, c, d): @@ -443,7 +440,7 @@ dis_with = """\ CALL 2 POP_TOP -%3d LOAD_CONST 2 (2) +%3d >> LOAD_CONST 2 (2) STORE_FAST 2 (y) LOAD_CONST 0 (None) RETURN_VALUE @@ -456,11 +453,7 @@ dis_with = """\ POP_EXCEPT POP_TOP POP_TOP - -%3d LOAD_CONST 2 (2) - STORE_FAST 2 (y) - LOAD_CONST 0 (None) - RETURN_VALUE + JUMP_BACKWARD 13 (to 30) >> COPY 3 POP_EXCEPT RERAISE 1 @@ -472,7 +465,6 @@ ExceptionTable: _with.__code__.co_firstlineno + 1, _with.__code__.co_firstlineno + 3, _with.__code__.co_firstlineno + 1, - _with.__code__.co_firstlineno + 3, ) async def _asyncwith(c): @@ -510,7 +502,7 @@ dis_asyncwith = """\ JUMP_BACKWARD_NO_INTERRUPT 4 (to 48) >> POP_TOP -%3d LOAD_CONST 2 (2) +%3d >> LOAD_CONST 2 (2) STORE_FAST 2 (y) LOAD_CONST 0 (None) RETURN_VALUE @@ -529,11 +521,7 @@ dis_asyncwith = """\ POP_EXCEPT POP_TOP POP_TOP - -%3d LOAD_CONST 2 (2) - STORE_FAST 2 (y) - LOAD_CONST 0 (None) - RETURN_VALUE + JUMP_BACKWARD 19 (to 58) >> COPY 3 POP_EXCEPT RERAISE 1 @@ -545,7 +533,6 @@ ExceptionTable: _asyncwith.__code__.co_firstlineno + 1, _asyncwith.__code__.co_firstlineno + 3, _asyncwith.__code__.co_firstlineno + 1, - _asyncwith.__code__.co_firstlineno + 3, ) |
