mirror of
https://github.com/python/cpython.git
synced 2025-11-11 11:01:39 +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
|
|
@ -366,14 +366,12 @@ def bug42562():
|
|||
LOAD_CONST 2 (0)
|
||||
--> BINARY_OP 11 (/)
|
||||
POP_TOP
|
||||
|
||||
%3d LOAD_FAST 1 (tb)
|
||||
RETURN_VALUE
|
||||
JUMP_FORWARD 30 (to 76)
|
||||
>> PUSH_EXC_INFO
|
||||
|
||||
%3d LOAD_GLOBAL 0 (Exception)
|
||||
CHECK_EXC_MATCH
|
||||
POP_JUMP_FORWARD_IF_FALSE 18 (to 72)
|
||||
POP_JUMP_FORWARD_IF_FALSE 17 (to 68)
|
||||
STORE_FAST 0 (e)
|
||||
|
||||
%3d LOAD_FAST 0 (e)
|
||||
|
|
@ -383,9 +381,7 @@ def bug42562():
|
|||
LOAD_CONST 0 (None)
|
||||
STORE_FAST 0 (e)
|
||||
DELETE_FAST 0 (e)
|
||||
|
||||
%3d LOAD_FAST 1 (tb)
|
||||
RETURN_VALUE
|
||||
JUMP_FORWARD 8 (to 76)
|
||||
>> LOAD_CONST 0 (None)
|
||||
STORE_FAST 0 (e)
|
||||
DELETE_FAST 0 (e)
|
||||
|
|
@ -395,15 +391,17 @@ def bug42562():
|
|||
>> COPY 3
|
||||
POP_EXCEPT
|
||||
RERAISE 1
|
||||
|
||||
%3d >> LOAD_FAST 1 (tb)
|
||||
RETURN_VALUE
|
||||
ExceptionTable:
|
||||
""" % (TRACEBACK_CODE.co_firstlineno,
|
||||
TRACEBACK_CODE.co_firstlineno + 1,
|
||||
TRACEBACK_CODE.co_firstlineno + 2,
|
||||
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)
|
||||
TRACEBACK_CODE.co_firstlineno + 3,
|
||||
TRACEBACK_CODE.co_firstlineno + 5)
|
||||
|
||||
def _fstring(a, b, c, d):
|
||||
return f'{a} {b:4} {c!r} {d!r:4}'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue