8000 gh-112355: fix calculation of jump target of ENTER_EXECUTOR in dis (#… · aisk/cpython@7342110 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7342110

Browse files
iritkatrielaisk
authored andcommitted
pythongh-112355: fix calculation of jump target of ENTER_EXECUTOR in dis (python#112377)
1 parent cff8909 commit 7342110

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Lib/dis.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
SET_FUNCTION_ATTRIBUTE = opmap['SET_FUNCTION_ATTRIBUTE']
3131
FUNCTION_ATTR_FLAGS = ('defaults', 'kwdefaults', 'annotations', 'closure')
3232

33+
ENTER_EXECUTOR = opmap['ENTER_EXECUTOR']
3334
LOAD_CONST = opmap['LOAD_CONST']
3435
RETURN_CONST = opmap['RETURN_CONST']
3536
LOAD_GLOBAL = opmap['LOAD_GLOBAL']
@@ -373,6 +374,8 @@ def _get_argval_argrepr(op, arg, offset, co_consts, names, varname_from_oparg,
373374
argval = offset + 2 + signed_arg*2
374375
caches = _get_cache_size(_all_opname[deop])
375376
argval += 2 * caches
377+
if deop == ENTER_EXECUTOR:
378+
argval += 2
376379
argrepr = f"to L{labels_map[argval]}"
377380
elif deop in (LOAD_FAST_LOAD_FAST, STORE_FAST_LOAD_FAST, STORE_FAST_STORE_FAST):
378381
arg1 = arg >> 4
@@ -605,7 +608,9 @@ def _parse_exception_table(code):
605608
return entries
606609

607610
def _is_backward_jump(op):
608-
return 'JUMP_BACKWARD' in opname[op]
611+
return opname[op] in ('JUMP_BACKWARD',
612+
'JUMP_BACKWARD_NO_INTERRUPT',
613+
'ENTER_EXECUTOR')
609614

610615
def _get_instructions_bytes(code, varname_from_oparg=None,
611616
names=None, co_consts=None,

0 commit comments

Comments
 (0)
0