gh-111354: simplify detection of RESUME after YIELD_VALUE at except-depth 1 (#111459)

This commit is contained in:
Irit Katriel 2023-11-02 10:18:43 +00:00 committed by GitHub
parent 970e719a7a
commit 52cc4af6ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 362 additions and 339 deletions

View File

@ -823,6 +823,8 @@ iterations of the loop.
.. versionchanged:: 3.12 .. versionchanged:: 3.12
oparg set to be the exception block depth, for efficient closing of generators. oparg set to be the exception block depth, for efficient closing of generators.
.. versionchanged:: 3.13
this opcode no longer has an oparg
.. opcode:: SETUP_ANNOTATIONS .. opcode:: SETUP_ANNOTATIONS
@ -1625,11 +1627,12 @@ iterations of the loop.
success (``True``) or failure (``False``). success (``True``) or failure (``False``).
.. opcode:: RESUME (where) .. opcode:: RESUME (context)
A no-op. Performs internal tracing, debugging and optimization checks. A no-op. Performs internal tracing, debugging and optimization checks.
The ``where`` operand marks where the ``RESUME`` occurs: The ``context`` oparand consists of two parts. The lowest two bits
indicate where the ``RESUME`` occurs:
* ``0`` The start of a function, which is neither a generator, coroutine * ``0`` The start of a function, which is neither a generator, coroutine
nor an async generator nor an async generator
@ -1637,8 +1640,14 @@ iterations of the loop.
* ``2`` After a ``yield from`` expression * ``2`` After a ``yield from`` expression
* ``3`` After an ``await`` expression * ``3`` After an ``await`` expression
The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0``
otherwise.
.. versionadded:: 3.11 .. versionadded:: 3.11
.. versionchanged:: 3.13
The oparg value changed to include information about except-depth
.. opcode:: RETURN_GENERATOR .. opcode:: RETURN_GENERATOR

View File

@ -945,6 +945,14 @@ Others
* None yet * None yet
CPython bytecode changes
========================
* ``YIELD_VALUE`` no longer has an oparg. The oparg of ``RESUME`` was
changed to add a bit indicating whether the except-depth is 1, which
is needed to optimize closing of generators.
(Contributed by Irit Katriel in :gh:`111354`.)
Porting to Python 3.13 Porting to Python 3.13
====================== ======================

View File

@ -1525,8 +1525,8 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[OPCODE_METADATA_SIZE] = {
[_SEND] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_ERROR_FLAG }, [_SEND] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_ERROR_FLAG },
[SEND] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_ERROR_FLAG }, [SEND] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_ERROR_FLAG },
[SEND_GEN] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG }, [SEND_GEN] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
[INSTRUMENTED_YIELD_VALUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG }, [INSTRUMENTED_YIELD_VALUE] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
[YIELD_VALUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, [YIELD_VALUE] = { true, INSTR_FMT_IX, 0 },
[POP_EXCEPT] = { true, INSTR_FMT_IX, 0 }, [POP_EXCEPT] = { true, INSTR_FMT_IX, 0 },
[RERAISE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG }, [RERAISE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
[END_ASYNC_FOR] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG }, [END_ASYNC_FOR] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
@ -2043,6 +2043,7 @@ const char *const _PyOpcode_OpName[268] = {
[UNARY_NEGATIVE] = "UNARY_NEGATIVE", [UNARY_NEGATIVE] = "UNARY_NEGATIVE",
[UNARY_NOT] = "UNARY_NOT", [UNARY_NOT] = "UNARY_NOT",
[WITH_EXCEPT_START] = "WITH_EXCEPT_START", [WITH_EXCEPT_START] = "WITH_EXCEPT_START",
[YIELD_VALUE] = "YIELD_VALUE",
[BINARY_OP] = "BINARY_OP", [BINARY_OP] = "BINARY_OP",
[BUILD_CONST_KEY_MAP] = "BUILD_CONST_KEY_MAP", [BUILD_CONST_KEY_MAP] = "BUILD_CONST_KEY_MAP",
[BUILD_LIST] = "BUILD_LIST", [BUILD_LIST] = "BUILD_LIST",
@ -2116,7 +2117,6 @@ const char *const _PyOpcode_OpName[268] = {
[SWAP] = "SWAP", [SWAP] = "SWAP",
[UNPACK_EX] = "UNPACK_EX", [UNPACK_EX] = "UNPACK_EX",
[UNPACK_SEQUENCE] = "UNPACK_SEQUENCE", [UNPACK_SEQUENCE] = "UNPACK_SEQUENCE",
[YIELD_VALUE] = "YIELD_VALUE",
[BINARY_OP_ADD_FLOAT] = "BINARY_OP_ADD_FLOAT", [BINARY_OP_ADD_FLOAT] = "BINARY_OP_ADD_FLOAT",
[BINARY_OP_ADD_INT] = "BINARY_OP_ADD_INT", [BINARY_OP_ADD_INT] = "BINARY_OP_ADD_INT",
[BINARY_OP_ADD_UNICODE] = "BINARY_OP_ADD_UNICODE", [BINARY_OP_ADD_UNICODE] = "BINARY_OP_ADD_UNICODE",

View File

@ -64,6 +64,8 @@ extern "C" {
#define RESUME_AFTER_YIELD_FROM 2 #define RESUME_AFTER_YIELD_FROM 2
#define RESUME_AFTER_AWAIT 3 #define RESUME_AFTER_AWAIT 3
#define RESUME_OPARG_LOCATION_MASK 0x3
#define RESUME_OPARG_DEPTH1_MASK 0x4
#ifdef __cplusplus #ifdef __cplusplus
} }

150
Include/opcode_ids.h generated
View File

@ -55,81 +55,81 @@ extern "C" {
#define UNARY_NEGATIVE 42 #define UNARY_NEGATIVE 42
#define UNARY_NOT 43 #define UNARY_NOT 43
#define WITH_EXCEPT_START 44 #define WITH_EXCEPT_START 44
#define HAVE_ARGUMENT 45 #define YIELD_VALUE 45
#define BINARY_OP 45 #define HAVE_ARGUMENT 46
#define BUILD_CONST_KEY_MAP 46 #define BINARY_OP 46
#define BUILD_LIST 47 #define BUILD_CONST_KEY_MAP 47
#define BUILD_MAP 48 #define BUILD_LIST 48
#define BUILD_SET 49 #define BUILD_MAP 49
#define BUILD_SLICE 50 #define BUILD_SET 50
#define BUILD_STRING 51 #define BUILD_SLICE 51
#define BUILD_TUPLE 52 #define BUILD_STRING 52
#define CALL 53 #define BUILD_TUPLE 53
#define CALL_FUNCTION_EX 54 #define CALL 54
#define CALL_INTRINSIC_1 55 #define CALL_FUNCTION_EX 55
#define CALL_INTRINSIC_2 56 #define CALL_INTRINSIC_1 56
#define CALL_KW 57 #define CALL_INTRINSIC_2 57
#define COMPARE_OP 58 #define CALL_KW 58
#define CONTAINS_OP 59 #define COMPARE_OP 59
#define CONVERT_VALUE 60 #define CONTAINS_OP 60
#define COPY 61 #define CONVERT_VALUE 61
#define COPY_FREE_VARS 62 #define COPY 62
#define DELETE_ATTR 63 #define COPY_FREE_VARS 63
#define DELETE_DEREF 64 #define DELETE_ATTR 64
#define DELETE_FAST 65 #define DELETE_DEREF 65
#define DELETE_GLOBAL 66 #define DELETE_FAST 66
#define DELETE_NAME 67 #define DELETE_GLOBAL 67
#define DICT_MERGE 68 #define DELETE_NAME 68
#define DICT_UPDATE 69 #define DICT_MERGE 69
#define ENTER_EXECUTOR 70 #define DICT_UPDATE 70
#define EXTENDED_ARG 71 #define ENTER_EXECUTOR 71
#define FOR_ITER 72 #define EXTENDED_ARG 72
#define GET_AWAITABLE 73 #define FOR_ITER 73
#define IMPORT_FROM 74 #define GET_AWAITABLE 74
#define IMPORT_NAME 75 #define IMPORT_FROM 75
#define IS_OP 76 #define IMPORT_NAME 76
#define JUMP_BACKWARD 77 #define IS_OP 77
#define JUMP_BACKWARD_NO_INTERRUPT 78 #define JUMP_BACKWARD 78
#define JUMP_FORWARD 79 #define JUMP_BACKWARD_NO_INTERRUPT 79
#define LIST_APPEND 80 #define JUMP_FORWARD 80
#define LIST_EXTEND 81 #define LIST_APPEND 81
#define LOAD_ATTR 82 #define LIST_EXTEND 82
#define LOAD_CONST 83 #define LOAD_ATTR 83
#define LOAD_DEREF 84 #define LOAD_CONST 84
#define LOAD_FAST 85 #define LOAD_DEREF 85
#define LOAD_FAST_AND_CLEAR 86 #define LOAD_FAST 86
#define LOAD_FAST_CHECK 87 #define LOAD_FAST_AND_CLEAR 87
#define LOAD_FAST_LOAD_FAST 88 #define LOAD_FAST_CHECK 88
#define LOAD_FROM_DICT_OR_DEREF 89 #define LOAD_FAST_LOAD_FAST 89
#define LOAD_FROM_DICT_OR_GLOBALS 90 #define LOAD_FROM_DICT_OR_DEREF 90
#define LOAD_GLOBAL 91 #define LOAD_FROM_DICT_OR_GLOBALS 91
#define LOAD_NAME 92 #define LOAD_GLOBAL 92
#define LOAD_SUPER_ATTR 93 #define LOAD_NAME 93
#define MAKE_CELL 94 #define LOAD_SUPER_ATTR 94
#define MAP_ADD 95 #define MAKE_CELL 95
#define MATCH_CLASS 96 #define MAP_ADD 96
#define POP_JUMP_IF_FALSE 97 #define MATCH_CLASS 97
#define POP_JUMP_IF_NONE 98 #define POP_JUMP_IF_FALSE 98
#define POP_JUMP_IF_NOT_NONE 99 #define POP_JUMP_IF_NONE 99
#define POP_JUMP_IF_TRUE 100 #define POP_JUMP_IF_NOT_NONE 100
#define RAISE_VARARGS 101 #define POP_JUMP_IF_TRUE 101
#define RERAISE 102 #define RAISE_VARARGS 102
#define RETURN_CONST 103 #define RERAISE 103
#define SEND 104 #define RETURN_CONST 104
#define SET_ADD 105 #define SEND 105
#define SET_FUNCTION_ATTRIBUTE 106 #define SET_ADD 106
#define SET_UPDATE 107 #define SET_FUNCTION_ATTRIBUTE 107
#define STORE_ATTR 108 #define SET_UPDATE 108
#define STORE_DEREF 109 #define STORE_ATTR 109
#define STORE_FAST 110 #define STORE_DEREF 110
#define STORE_FAST_LOAD_FAST 111 #define STORE_FAST 111
#define STORE_FAST_STORE_FAST 112 #define STORE_FAST_LOAD_FAST 112
#define STORE_GLOBAL 113 #define STORE_FAST_STORE_FAST 113
#define STORE_NAME 114 #define STORE_GLOBAL 114
#define SWAP 115 #define STORE_NAME 115
#define UNPACK_EX 116 #define SWAP 116
#define UNPACK_SEQUENCE 117 #define UNPACK_EX 117
#define YIELD_VALUE 118 #define UNPACK_SEQUENCE 118
#define RESUME 149 #define RESUME 149
#define BINARY_OP_ADD_FLOAT 150 #define BINARY_OP_ADD_FLOAT 150
#define BINARY_OP_ADD_INT 151 #define BINARY_OP_ADD_INT 151

150
Lib/_opcode_metadata.py generated
View File

@ -224,80 +224,80 @@ opmap = {
'UNARY_NEGATIVE': 42, 'UNARY_NEGATIVE': 42,
'UNARY_NOT': 43, 'UNARY_NOT': 43,
'WITH_EXCEPT_START': 44, 'WITH_EXCEPT_START': 44,
'BINARY_OP': 45, 'YIELD_VALUE': 45,
'BUILD_CONST_KEY_MAP': 46, 'BINARY_OP': 46,
'BUILD_LIST': 47, 'BUILD_CONST_KEY_MAP': 47,
'BUILD_MAP': 48, 'BUILD_LIST': 48,
'BUILD_SET': 49, 'BUILD_MAP': 49,
'BUILD_SLICE': 50, 'BUILD_SET': 50,
'BUILD_STRING': 51, 'BUILD_SLICE': 51,
'BUILD_TUPLE': 52, 'BUILD_STRING': 52,
'CALL': 53, 'BUILD_TUPLE': 53,
'CALL_FUNCTION_EX': 54, 'CALL': 54,
'CALL_INTRINSIC_1': 55, 'CALL_FUNCTION_EX': 55,
'CALL_INTRINSIC_2': 56, 'CALL_INTRINSIC_1': 56,
'CALL_KW': 57, 'CALL_INTRINSIC_2': 57,
'COMPARE_OP': 58, 'CALL_KW': 58,
'CONTAINS_OP': 59, 'COMPARE_OP': 59,
'CONVERT_VALUE': 60, 'CONTAINS_OP': 60,
'COPY': 61, 'CONVERT_VALUE': 61,
'COPY_FREE_VARS': 62, 'COPY': 62,
'DELETE_ATTR': 63, 'COPY_FREE_VARS': 63,
'DELETE_DEREF': 64, 'DELETE_ATTR': 64,
'DELETE_FAST': 65, 'DELETE_DEREF': 65,
'DELETE_GLOBAL': 66, 'DELETE_FAST': 66,
'DELETE_NAME': 67, 'DELETE_GLOBAL': 67,
'DICT_MERGE': 68, 'DELETE_NAME': 68,
'DICT_UPDATE': 69, 'DICT_MERGE': 69,
'ENTER_EXECUTOR': 70, 'DICT_UPDATE': 70,
'EXTENDED_ARG': 71, 'ENTER_EXECUTOR': 71,
'FOR_ITER': 72, 'EXTENDED_ARG': 72,
'GET_AWAITABLE': 73, 'FOR_ITER': 73,
'IMPORT_FROM': 74, 'GET_AWAITABLE': 74,
'IMPORT_NAME': 75, 'IMPORT_FROM': 75,
'IS_OP': 76, 'IMPORT_NAME': 76,
'JUMP_BACKWARD': 77, 'IS_OP': 77,
'JUMP_BACKWARD_NO_INTERRUPT': 78, 'JUMP_BACKWARD': 78,
'JUMP_FORWARD': 79, 'JUMP_BACKWARD_NO_INTERRUPT': 79,
'LIST_APPEND': 80, 'JUMP_FORWARD': 80,
'LIST_EXTEND': 81, 'LIST_APPEND': 81,
'LOAD_ATTR': 82, 'LIST_EXTEND': 82,
'LOAD_CONST': 83, 'LOAD_ATTR': 83,
'LOAD_DEREF': 84, 'LOAD_CONST': 84,
'LOAD_FAST': 85, 'LOAD_DEREF': 85,
'LOAD_FAST_AND_CLEAR': 86, 'LOAD_FAST': 86,
'LOAD_FAST_CHECK': 87, 'LOAD_FAST_AND_CLEAR': 87,
'LOAD_FAST_LOAD_FAST': 88, 'LOAD_FAST_CHECK': 88,
'LOAD_FROM_DICT_OR_DEREF': 89, 'LOAD_FAST_LOAD_FAST': 89,
'LOAD_FROM_DICT_OR_GLOBALS': 90, 'LOAD_FROM_DICT_OR_DEREF': 90,
'LOAD_GLOBAL': 91, 'LOAD_FROM_DICT_OR_GLOBALS': 91,
'LOAD_NAME': 92, 'LOAD_GLOBAL': 92,
'LOAD_SUPER_ATTR': 93, 'LOAD_NAME': 93,
'MAKE_CELL': 94, 'LOAD_SUPER_ATTR': 94,
'MAP_ADD': 95, 'MAKE_CELL': 95,
'MATCH_CLASS': 96, 'MAP_ADD': 96,
'POP_JUMP_IF_FALSE': 97, 'MATCH_CLASS': 97,
'POP_JUMP_IF_NONE': 98, 'POP_JUMP_IF_FALSE': 98,
'POP_JUMP_IF_NOT_NONE': 99, 'POP_JUMP_IF_NONE': 99,
'POP_JUMP_IF_TRUE': 100, 'POP_JUMP_IF_NOT_NONE': 100,
'RAISE_VARARGS': 101, 'POP_JUMP_IF_TRUE': 101,
'RERAISE': 102, 'RAISE_VARARGS': 102,
'RETURN_CONST': 103, 'RERAISE': 103,
'SEND': 104, 'RETURN_CONST': 104,
'SET_ADD': 105, 'SEND': 105,
'SET_FUNCTION_ATTRIBUTE': 106, 'SET_ADD': 106,
'SET_UPDATE': 107, 'SET_FUNCTION_ATTRIBUTE': 107,
'STORE_ATTR': 108, 'SET_UPDATE': 108,
'STORE_DEREF': 109, 'STORE_ATTR': 109,
'STORE_FAST': 110, 'STORE_DEREF': 110,
'STORE_FAST_LOAD_FAST': 111, 'STORE_FAST': 111,
'STORE_FAST_STORE_FAST': 112, 'STORE_FAST_LOAD_FAST': 112,
'STORE_GLOBAL': 113, 'STORE_FAST_STORE_FAST': 113,
'STORE_NAME': 114, 'STORE_GLOBAL': 114,
'SWAP': 115, 'STORE_NAME': 115,
'UNPACK_EX': 116, 'SWAP': 116,
'UNPACK_SEQUENCE': 117, 'UNPACK_EX': 117,
'YIELD_VALUE': 118, 'UNPACK_SEQUENCE': 118,
'RESUME': 149, 'RESUME': 149,
'INSTRUMENTED_RESUME': 236, 'INSTRUMENTED_RESUME': 236,
'INSTRUMENTED_END_FOR': 237, 'INSTRUMENTED_END_FOR': 237,
@ -332,4 +332,4 @@ opmap = {
'STORE_FAST_MAYBE_NULL': 267, 'STORE_FAST_MAYBE_NULL': 267,
} }
MIN_INSTRUMENTED_OPCODE = 236 MIN_INSTRUMENTED_OPCODE = 236
HAVE_ARGUMENT = 45 HAVE_ARGUMENT = 46

View File

@ -459,6 +459,7 @@ _code_type = type(_write_atomic.__code__)
# Python 3.13a1 3561 (Add cache entry to branch instructions) # Python 3.13a1 3561 (Add cache entry to branch instructions)
# Python 3.13a1 3562 (Assign opcode IDs for internal ops in separate range) # Python 3.13a1 3562 (Assign opcode IDs for internal ops in separate range)
# Python 3.13a1 3563 (Add CALL_KW and remove KW_NAMES) # Python 3.13a1 3563 (Add CALL_KW and remove KW_NAMES)
# Python 3.13a1 3564 (Removed oparg from YIELD_VALUE, changed oparg values of RESUME)
# Python 3.14 will start with 3600 # Python 3.14 will start with 3600
@ -475,7 +476,7 @@ _code_type = type(_write_atomic.__code__)
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
# in PC/launcher.c must also be updated. # in PC/launcher.c must also be updated.
MAGIC_NUMBER = (3563).to_bytes(2, 'little') + b'\r\n' MAGIC_NUMBER = (3564).to_bytes(2, 'little') + b'\r\n'
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c

View File

@ -532,7 +532,7 @@ dis_asyncwith = """\
GET_AWAITABLE 1 GET_AWAITABLE 1
LOAD_CONST 0 (None) LOAD_CONST 0 (None)
>> SEND 3 (to 24) >> SEND 3 (to 24)
YIELD_VALUE 2 YIELD_VALUE
RESUME 3 RESUME 3
JUMP_BACKWARD_NO_INTERRUPT 5 (to 14) JUMP_BACKWARD_NO_INTERRUPT 5 (to 14)
>> END_SEND >> END_SEND
@ -548,7 +548,7 @@ dis_asyncwith = """\
GET_AWAITABLE 2 GET_AWAITABLE 2
LOAD_CONST 0 (None) LOAD_CONST 0 (None)
>> SEND 3 (to 60) >> SEND 3 (to 60)
YIELD_VALUE 2 YIELD_VALUE
RESUME 3 RESUME 3
JUMP_BACKWARD_NO_INTERRUPT 5 (to 50) JUMP_BACKWARD_NO_INTERRUPT 5 (to 50)
>> END_SEND >> END_SEND
@ -571,7 +571,7 @@ None JUMP_BACKWARD 11 (to 60)
GET_AWAITABLE 2 GET_AWAITABLE 2
LOAD_CONST 0 (None) LOAD_CONST 0 (None)
>> SEND 4 (to 102) >> SEND 4 (to 102)
YIELD_VALUE 3 YIELD_VALUE
RESUME 3 RESUME 3
JUMP_BACKWARD_NO_INTERRUPT 5 (to 90) JUMP_BACKWARD_NO_INTERRUPT 5 (to 90)
>> CLEANUP_THROW >> CLEANUP_THROW
@ -762,8 +762,8 @@ None COPY_FREE_VARS 1
LOAD_DEREF 2 (x) LOAD_DEREF 2 (x)
LOAD_FAST 1 (z) LOAD_FAST 1 (z)
BINARY_OP 0 (+) BINARY_OP 0 (+)
YIELD_VALUE 1 YIELD_VALUE
RESUME 1 RESUME 5
POP_TOP POP_TOP
JUMP_BACKWARD 12 (to 10) JUMP_BACKWARD 12 (to 10)
>> END_FOR >> END_FOR
@ -1637,197 +1637,197 @@ def _prepare_test_cases():
Instruction = dis.Instruction Instruction = dis.Instruction
expected_opinfo_outer = [ expected_opinfo_outer = [
Instruction(opname='MAKE_CELL', opcode=94, arg=0, argval='a', argrepr='a', offset=0, start_offset=0, starts_line=True, line_number=None, is_jump_target=False, positions=None), Instruction(opname='MAKE_CELL', opcode=95, arg=0, argval='a', argrepr='a', offset=0, start_offset=0, starts_line=True, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='MAKE_CELL', opcode=94, arg=1, argval='b', argrepr='b', offset=2, start_offset=2, starts_line=False, line_number=None, is_jump_target=False, positions=None), Instruction(opname='MAKE_CELL', opcode=95, arg=1, argval='b', argrepr='b', offset=2, start_offset=2, starts_line=False, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='RESUME', opcode=149, arg=0, argval=0, argrepr='', offset=4, start_offset=4, starts_line=True, line_number=1, is_jump_target=False, positions=None), Instruction(opname='RESUME', opcode=149, arg=0, argval=0, argrepr='', offset=4, start_offset=4, starts_line=True, line_number=1, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=5, argval=(3, 4), argrepr='(3, 4)', offset=6, start_offset=6, starts_line=True, line_number=2, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=5, argval=(3, 4), argrepr='(3, 4)', offset=6, start_offset=6, starts_line=True, line_number=2, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=0, argval='a', argrepr='a', offset=8, start_offset=8, starts_line=False, line_number=2, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=0, argval='a', argrepr='a', offset=8, start_offset=8, starts_line=False, line_number=2, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=1, argval='b', argrepr='b', offset=10, start_offset=10, starts_line=False, line_number=2, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=1, argval='b', argrepr='b', offset=10, start_offset=10, starts_line=False, line_number=2, is_jump_target=False, positions=None),
Instruction(opname='BUILD_TUPLE', opcode=52, arg=2, argval=2, argrepr='', offset=12, start_offset=12, starts_line=False, line_number=2, is_jump_target=False, positions=None), Instruction(opname='BUILD_TUPLE', opcode=53, arg=2, argval=2, argrepr='', offset=12, start_offset=12, starts_line=False, line_number=2, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=1, argval=code_object_f, argrepr=repr(code_object_f), offset=14, start_offset=14, starts_line=False, line_number=2, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=1, argval=code_object_f, argrepr=repr(code_object_f), offset=14, start_offset=14, starts_line=False, line_number=2, is_jump_target=False, positions=None),
Instruction(opname='MAKE_FUNCTION', opcode=26, arg=None, argval=None, argrepr='', offset=16, start_offset=16, starts_line=False, line_number=2, is_jump_target=False, positions=None), Instruction(opname='MAKE_FUNCTION', opcode=26, arg=None, argval=None, argrepr='', offset=16, start_offset=16, starts_line=False, line_number=2, is_jump_target=False, positions=None),
Instruction(opname='SET_FUNCTION_ATTRIBUTE', opcode=106, arg=8, argval=8, argrepr='closure', offset=18, start_offset=18, starts_line=False, line_number=2, is_jump_target=False, positions=None), Instruction(opname='SET_FUNCTION_ATTRIBUTE', opcode=107, arg=8, argval=8, argrepr='closure', offset=18, start_offset=18, starts_line=False, line_number=2, is_jump_target=False, positions=None),
Instruction(opname='SET_FUNCTION_ATTRIBUTE', opcode=106, arg=1, argval=1, argrepr='defaults', offset=20, start_offset=20, starts_line=False, line_number=2, is_jump_target=False, positions=None), Instruction(opname='SET_FUNCTION_ATTRIBUTE', opcode=107, arg=1, argval=1, argrepr='defaults', offset=20, start_offset=20, starts_line=False, line_number=2, is_jump_target=False, positions=None),
Instruction(opname='STORE_FAST', opcode=110, arg=2, argval='f', argrepr='f', offset=22, start_offset=22, starts_line=False, line_number=2, is_jump_target=False, positions=None), Instruction(opname='STORE_FAST', opcode=111, arg=2, argval='f', argrepr='f', offset=22, start_offset=22, starts_line=False, line_number=2, is_jump_target=False, positions=None),
Instruction(opname='LOAD_GLOBAL', opcode=91, arg=1, argval='print', argrepr='print + NULL', offset=24, start_offset=24, starts_line=True, line_number=7, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=92, arg=1, argval='print', argrepr='print + NULL', offset=24, start_offset=24, starts_line=True, line_number=7, is_jump_target=False, positions=None),
Instruction(opname='LOAD_DEREF', opcode=84, arg=0, argval='a', argrepr='a', offset=34, start_offset=34, starts_line=False, line_number=7, is_jump_target=False, positions=None), Instruction(opname='LOAD_DEREF', opcode=85, arg=0, argval='a', argrepr='a', offset=34, start_offset=34, starts_line=False, line_number=7, is_jump_target=False, positions=None),
Instruction(opname='LOAD_DEREF', opcode=84, arg=1, argval='b', argrepr='b', offset=36, start_offset=36, starts_line=False, line_number=7, is_jump_target=False, positions=None), Instruction(opname='LOAD_DEREF', opcode=85, arg=1, argval='b', argrepr='b', offset=36, start_offset=36, starts_line=False, line_number=7, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=2, argval='', argrepr="''", offset=38, start_offset=38, starts_line=False, line_number=7, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=2, argval='', argrepr="''", offset=38, start_offset=38, starts_line=False, line_number=7, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=3, argval=1, argrepr='1', offset=40, start_offset=40, starts_line=False, line_number=7, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=3, argval=1, argrepr='1', offset=40, start_offset=40, starts_line=False, line_number=7, is_jump_target=False, positions=None),
Instruction(opname='BUILD_LIST', opcode=47, arg=0, argval=0, argrepr='', offset=42, start_offset=42, starts_line=False, line_number=7, is_jump_target=False, positions=None), Instruction(opname='BUILD_LIST', opcode=48, arg=0, argval=0, argrepr='', offset=42, start_offset=42, starts_line=False, line_number=7, is_jump_target=False, positions=None),
Instruction(opname='BUILD_MAP', opcode=48, arg=0, argval=0, argrepr='', offset=44, start_offset=44, starts_line=False, line_number=7, is_jump_target=False, positions=None), Instruction(opname='BUILD_MAP', opcode=49, arg=0, argval=0, argrepr='', offset=44, start_offset=44, starts_line=False, line_number=7, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=4, argval='Hello world!', argrepr="'Hello world!'", offset=46, start_offset=46, starts_line=False, line_number=7, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=4, argval='Hello world!', argrepr="'Hello world!'", offset=46, start_offset=46, starts_line=False, line_number=7, is_jump_target=False, positions=None),
Instruction(opname='CALL', opcode=53, arg=7, argval=7, argrepr='', offset=48, start_offset=48, starts_line=False, line_number=7, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=54, arg=7, argval=7, argrepr='', offset=48, start_offset=48, starts_line=False, line_number=7, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=56, start_offset=56, starts_line=False, line_number=7, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=56, start_offset=56, starts_line=False, line_number=7, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=2, argval='f', argrepr='f', offset=58, start_offset=58, starts_line=True, line_number=8, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=2, argval='f', argrepr='f', offset=58, start_offset=58, starts_line=True, line_number=8, is_jump_target=False, positions=None),
Instruction(opname='RETURN_VALUE', opcode=36, arg=None, argval=None, argrepr='', offset=60, start_offset=60, starts_line=False, line_number=8, is_jump_target=False, positions=None), Instruction(opname='RETURN_VALUE', opcode=36, arg=None, argval=None, argrepr='', offset=60, start_offset=60, starts_line=False, line_number=8, is_jump_target=False, positions=None),
] ]
expected_opinfo_f = [ expected_opinfo_f = [
Instruction(opname='COPY_FREE_VARS', opcode=62, arg=2, argval=2, argrepr='', offset=0, start_offset=0, starts_line=True, line_number=None, is_jump_target=False, positions=None), Instruction(opname='COPY_FREE_VARS', opcode=63, arg=2, argval=2, argrepr='', offset=0, start_offset=0, starts_line=True, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='MAKE_CELL', opcode=94, arg=0, argval='c', argrepr='c', offset=2, start_offset=2, starts_line=False, line_number=None, is_jump_target=False, positions=None), Instruction(opname='MAKE_CELL', opcode=95, arg=0, argval='c', argrepr='c', offset=2, start_offset=2, starts_line=False, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='MAKE_CELL', opcode=94, arg=1, argval='d', argrepr='d', offset=4, start_offset=4, starts_line=False, line_number=None, is_jump_target=False, positions=None), Instruction(opname='MAKE_CELL', opcode=95, arg=1, argval='d', argrepr='d', offset=4, start_offset=4, starts_line=False, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='RESUME', opcode=149, arg=0, argval=0, argrepr='', offset=6, start_offset=6, starts_line=True, line_number=2, is_jump_target=False, positions=None), Instruction(opname='RESUME', opcode=149, arg=0, argval=0, argrepr='', offset=6, start_offset=6, starts_line=True, line_number=2, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=2, argval=(5, 6), argrepr='(5, 6)', offset=8, start_offset=8, starts_line=True, line_number=3, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=2, argval=(5, 6), argrepr='(5, 6)', offset=8, start_offset=8, starts_line=True, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=3, argval='a', argrepr='a', offset=10, start_offset=10, starts_line=False, line_number=3, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=3, argval='a', argrepr='a', offset=10, start_offset=10, starts_line=False, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=4, argval='b', argrepr='b', offset=12, start_offset=12, starts_line=False, line_number=3, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=4, argval='b', argrepr='b', offset=12, start_offset=12, starts_line=False, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=0, argval='c', argrepr='c', offset=14, start_offset=14, starts_line=False, line_number=3, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=0, argval='c', argrepr='c', offset=14, start_offset=14, starts_line=False, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=1, argval='d', argrepr='d', offset=16, start_offset=16, starts_line=False, line_number=3, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=1, argval='d', argrepr='d', offset=16, start_offset=16, starts_line=False, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='BUILD_TUPLE', opcode=52, arg=4, argval=4, argrepr='', offset=18, start_offset=18, starts_line=False, line_number=3, is_jump_target=False, positions=None), Instruction(opname='BUILD_TUPLE', opcode=53, arg=4, argval=4, argrepr='', offset=18, start_offset=18, starts_line=False, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=1, argval=code_object_inner, argrepr=repr(code_object_inner), offset=20, start_offset=20, starts_line=False, line_number=3, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=1, argval=code_object_inner, argrepr=repr(code_object_inner), offset=20, start_offset=20, starts_line=False, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='MAKE_FUNCTION', opcode=26, arg=None, argval=None, argrepr='', offset=22, start_offset=22, starts_line=False, line_number=3, is_jump_target=False, positions=None), Instruction(opname='MAKE_FUNCTION', opcode=26, arg=None, argval=None, argrepr='', offset=22, start_offset=22, starts_line=False, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='SET_FUNCTION_ATTRIBUTE', opcode=106, arg=8, argval=8, argrepr='closure', offset=24, start_offset=24, starts_line=False, line_number=3, is_jump_target=False, positions=None), Instruction(opname='SET_FUNCTION_ATTRIBUTE', opcode=107, arg=8, argval=8, argrepr='closure', offset=24, start_offset=24, starts_line=False, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='SET_FUNCTION_ATTRIBUTE', opcode=106, arg=1, argval=1, argrepr='defaults', offset=26, start_offset=26, starts_line=False, line_number=3, is_jump_target=False, positions=None), Instruction(opname='SET_FUNCTION_ATTRIBUTE', opcode=107, arg=1, argval=1, argrepr='defaults', offset=26, start_offset=26, starts_line=False, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='STORE_FAST', opcode=110, arg=2, argval='inner', argrepr='inner', offset=28, start_offset=28, starts_line=False, line_number=3, is_jump_target=False, positions=None), Instruction(opname='STORE_FAST', opcode=111, arg=2, argval='inner', argrepr='inner', offset=28, start_offset=28, starts_line=False, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='LOAD_GLOBAL', opcode=91, arg=1, argval='print', argrepr='print + NULL', offset=30, start_offset=30, starts_line=True, line_number=5, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=92, arg=1, argval='print', argrepr='print + NULL', offset=30, start_offset=30, starts_line=True, line_number=5, is_jump_target=False, positions=None),
Instruction(opname='LOAD_DEREF', opcode=84, arg=3, argval='a', argrepr='a', offset=40, start_offset=40, starts_line=False, line_number=5, is_jump_target=False, positions=None), Instruction(opname='LOAD_DEREF', opcode=85, arg=3, argval='a', argrepr='a', offset=40, start_offset=40, starts_line=False, line_number=5, is_jump_target=False, positions=None),
Instruction(opname='LOAD_DEREF', opcode=84, arg=4, argval='b', argrepr='b', offset=42, start_offset=42, starts_line=False, line_number=5, is_jump_target=False, positions=None), Instruction(opname='LOAD_DEREF', opcode=85, arg=4, argval='b', argrepr='b', offset=42, start_offset=42, starts_line=False, line_number=5, is_jump_target=False, positions=None),
Instruction(opname='LOAD_DEREF', opcode=84, arg=0, argval='c', argrepr='c', offset=44, start_offset=44, starts_line=False, line_number=5, is_jump_target=False, positions=None), Instruction(opname='LOAD_DEREF', opcode=85, arg=0, argval='c', argrepr='c', offset=44, start_offset=44, starts_line=False, line_number=5, is_jump_target=False, positions=None),
Instruction(opname='LOAD_DEREF', opcode=84, arg=1, argval='d', argrepr='d', offset=46, start_offset=46, starts_line=False, line_number=5, is_jump_target=False, positions=None), Instruction(opname='LOAD_DEREF', opcode=85, arg=1, argval='d', argrepr='d', offset=46, start_offset=46, starts_line=False, line_number=5, is_jump_target=False, positions=None),
Instruction(opname='CALL', opcode=53, arg=4, argval=4, argrepr='', offset=48, start_offset=48, starts_line=False, line_number=5, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=54, arg=4, argval=4, argrepr='', offset=48, start_offset=48, starts_line=False, line_number=5, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=56, start_offset=56, starts_line=False, line_number=5, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=56, start_offset=56, starts_line=False, line_number=5, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=2, argval='inner', argrepr='inner', offset=58, start_offset=58, starts_line=True, line_number=6, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=2, argval='inner', argrepr='inner', offset=58, start_offset=58, starts_line=True, line_number=6, is_jump_target=False, positions=None),
Instruction(opname='RETURN_VALUE', opcode=36, arg=None, argval=None, argrepr='', offset=60, start_offset=60, starts_line=False, line_number=6, is_jump_target=False, positions=None), Instruction(opname='RETURN_VALUE', opcode=36, arg=None, argval=None, argrepr='', offset=60, start_offset=60, starts_line=False, line_number=6, is_jump_target=False, positions=None),
] ]
expected_opinfo_inner = [ expected_opinfo_inner = [
Instruction(opname='COPY_FREE_VARS', opcode=62, arg=4, argval=4, argrepr='', offset=0, start_offset=0, starts_line=True, line_number=None, is_jump_target=False, positions=None), Instruction(opname='COPY_FREE_VARS', opcode=63, arg=4, argval=4, argrepr='', offset=0, start_offset=0, starts_line=True, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='RESUME', opcode=149, arg=0, argval=0, argrepr='', offset=2, start_offset=2, starts_line=True, line_number=3, is_jump_target=False, positions=None), Instruction(opname='RESUME', opcode=149, arg=0, argval=0, argrepr='', offset=2, start_offset=2, starts_line=True, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='LOAD_GLOBAL', opcode=91, arg=1, argval='print', argrepr='print + NULL', offset=4, start_offset=4, starts_line=True, line_number=4, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=92, arg=1, argval='print', argrepr='print + NULL', offset=4, start_offset=4, starts_line=True, line_number=4, is_jump_target=False, positions=None),
Instruction(opname='LOAD_DEREF', opcode=84, arg=2, argval='a', argrepr='a', offset=14, start_offset=14, starts_line=False, line_number=4, is_jump_target=False, positions=None), Instruction(opname='LOAD_DEREF', opcode=85, arg=2, argval='a', argrepr='a', offset=14, start_offset=14, starts_line=False, line_number=4, is_jump_target=False, positions=None),
Instruction(opname='LOAD_DEREF', opcode=84, arg=3, argval='b', argrepr='b', offset=16, start_offset=16, starts_line=False, line_number=4, is_jump_target=False, positions=None), Instruction(opname='LOAD_DEREF', opcode=85, arg=3, argval='b', argrepr='b', offset=16, start_offset=16, starts_line=False, line_number=4, is_jump_target=False, positions=None),
Instruction(opname='LOAD_DEREF', opcode=84, arg=4, argval='c', argrepr='c', offset=18, start_offset=18, starts_line=False, line_number=4, is_jump_target=False, positions=None), Instruction(opname='LOAD_DEREF', opcode=85, arg=4, argval='c', argrepr='c', offset=18, start_offset=18, starts_line=False, line_number=4, is_jump_target=False, positions=None),
Instruction(opname='LOAD_DEREF', opcode=84, arg=5, argval='d', argrepr='d', offset=20, start_offset=20, starts_line=False, line_number=4, is_jump_target=False, positions=None), Instruction(opname='LOAD_DEREF', opcode=85, arg=5, argval='d', argrepr='d', offset=20, start_offset=20, starts_line=False, line_number=4, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST_LOAD_FAST', opcode=88, arg=1, argval=('e', 'f'), argrepr='e, f', offset=22, start_offset=22, starts_line=False, line_number=4, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST_LOAD_FAST', opcode=89, arg=1, argval=('e', 'f'), argrepr='e, f', offset=22, start_offset=22, starts_line=False, line_number=4, is_jump_target=False, positions=None),
Instruction(opname='CALL', opcode=53, arg=6, argval=6, argrepr='', offset=24, start_offset=24, starts_line=False, line_number=4, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=54, arg=6, argval=6, argrepr='', offset=24, start_offset=24, starts_line=False, line_number=4, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=32, start_offset=32, starts_line=False, line_number=4, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=32, start_offset=32, starts_line=False, line_number=4, is_jump_target=False, positions=None),
Instruction(opname='RETURN_CONST', opcode=103, arg=0, argval=None, argrepr='None', offset=34, start_offset=34, starts_line=False, line_number=4, is_jump_target=False, positions=None), Instruction(opname='RETURN_CONST', opcode=104, arg=0, argval=None, argrepr='None', offset=34, start_offset=34, starts_line=False, line_number=4, is_jump_target=False, positions=None),
] ]
expected_opinfo_jumpy = [ expected_opinfo_jumpy = [
Instruction(opname='RESUME', opcode=149, arg=0, argval=0, argrepr='', offset=0, start_offset=0, starts_line=True, line_number=1, is_jump_target=False, positions=None), Instruction(opname='RESUME', opcode=149, arg=0, argval=0, argrepr='', offset=0, start_offset=0, starts_line=True, line_number=1, is_jump_target=False, positions=None),
Instruction(opname='LOAD_GLOBAL', opcode=91, arg=1, argval='range', argrepr='range + NULL', offset=2, start_offset=2, starts_line=True, line_number=3, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=92, arg=1, argval='range', argrepr='range + NULL', offset=2, start_offset=2, starts_line=True, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=1, argval=10, argrepr='10', offset=12, start_offset=12, starts_line=False, line_number=3, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=1, argval=10, argrepr='10', offset=12, start_offset=12, starts_line=False, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='CALL', opcode=53, arg=1, argval=1, argrepr='', offset=14, start_offset=14, starts_line=False, line_number=3, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=54, arg=1, argval=1, argrepr='', offset=14, start_offset=14, starts_line=False, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='GET_ITER', opcode=19, arg=None, argval=None, argrepr='', offset=22, start_offset=22, starts_line=False, line_number=3, is_jump_target=False, positions=None), Instruction(opname='GET_ITER', opcode=19, arg=None, argval=None, argrepr='', offset=22, start_offset=22, starts_line=False, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='FOR_ITER', opcode=72, arg=30, argval=88, argrepr='to 88', offset=24, start_offset=24, starts_line=False, line_number=3, is_jump_target=True, positions=None), Instruction(opname='FOR_ITER', opcode=73, arg=30, argval=88, argrepr='to 88', offset=24, start_offset=24, starts_line=False, line_number=3, is_jump_target=True, positions=None),
Instruction(opname='STORE_FAST', opcode=110, arg=0, argval='i', argrepr='i', offset=28, start_offset=28, starts_line=False, line_number=3, is_jump_target=False, positions=None), Instruction(opname='STORE_FAST', opcode=111, arg=0, argval='i', argrepr='i', offset=28, start_offset=28, starts_line=False, line_number=3, is_jump_target=False, positions=None),
Instruction(opname='LOAD_GLOBAL', opcode=91, arg=3, argval='print', argrepr='print + NULL', offset=30, start_offset=30, starts_line=True, line_number=4, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=92, arg=3, argval='print', argrepr='print + NULL', offset=30, start_offset=30, starts_line=True, line_number=4, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=0, argval='i', argrepr='i', offset=40, start_offset=40, starts_line=False, line_number=4, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=0, argval='i', argrepr='i', offset=40, start_offset=40, starts_line=False, line_number=4, is_jump_target=False, positions=None),
Instruction(opname='CALL', opcode=53, arg=1, argval=1, argrepr='', offset=42, start_offset=42, starts_line=False, line_number=4, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=54, arg=1, argval=1, argrepr='', offset=42, start_offset=42, starts_line=False, line_number=4, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=50, start_offset=50, starts_line=False, line_number=4, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=50, start_offset=50, starts_line=False, line_number=4, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=0, argval='i', argrepr='i', offset=52, start_offset=52, starts_line=True, line_number=5, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=0, argval='i', argrepr='i', offset=52, start_offset=52, starts_line=True, line_number=5, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=2, argval=4, argrepr='4', offset=54, start_offset=54, starts_line=False, line_number=5, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=2, argval=4, argrepr='4', offset=54, start_offset=54, starts_line=False, line_number=5, is_jump_target=False, positions=None),
Instruction(opname='COMPARE_OP', opcode=58, arg=18, argval='<', argrepr='bool(<)', offset=56, start_offset=56, starts_line=False, line_number=5, is_jump_target=False, positions=None), Instruction(opname='COMPARE_OP', opcode=59, arg=18, argval='<', argrepr='bool(<)', offset=56, start_offset=56, starts_line=False, line_number=5, is_jump_target=False, positions=None),
Instruction(opname='POP_JUMP_IF_FALSE', opcode=97, arg=2, argval=68, argrepr='to 68', offset=60, start_offset=60, starts_line=False, line_number=5, is_jump_target=False, positions=None), Instruction(opname='POP_JUMP_IF_FALSE', opcode=98, arg=2, argval=68, argrepr='to 68', offset=60, start_offset=60, starts_line=False, line_number=5, is_jump_target=False, positions=None),
Instruction(opname='JUMP_BACKWARD', opcode=77, arg=22, argval=24, argrepr='to 24', offset=64, start_offset=64, starts_line=True, line_number=6, is_jump_target=False, positions=None), Instruction(opname='JUMP_BACKWARD', opcode=78, arg=22, argval=24, argrepr='to 24', offset=64, start_offset=64, starts_line=True, line_number=6, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=0, argval='i', argrepr='i', offset=68, start_offset=68, starts_line=True, line_number=7, is_jump_target=True, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=0, argval='i', argrepr='i', offset=68, start_offset=68, starts_line=True, line_number=7, is_jump_target=True, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=3, argval=6, argrepr='6', offset=70, start_offset=70, starts_line=False, line_number=7, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=3, argval=6, argrepr='6', offset=70, start_offset=70, starts_line=False, line_number=7, is_jump_target=False, positions=None),
Instruction(opname='COMPARE_OP', opcode=58, arg=148, argval='>', argrepr='bool(>)', offset=72, start_offset=72, starts_line=False, line_number=7, is_jump_target=False, positions=None), Instruction(opname='COMPARE_OP', opcode=59, arg=148, argval='>', argrepr='bool(>)', offset=72, start_offset=72, starts_line=False, line_number=7, is_jump_target=False, positions=None),
Instruction(opname='POP_JUMP_IF_TRUE', opcode=100, arg=2, argval=84, argrepr='to 84', offset=76, start_offset=76, starts_line=False, line_number=7, is_jump_target=False, positions=None), Instruction(opname='POP_JUMP_IF_TRUE', opcode=101, arg=2, argval=84, argrepr='to 84', offset=76, start_offset=76, starts_line=False, line_number=7, is_jump_target=False, positions=None),
Instruction(opname='JUMP_BACKWARD', opcode=77, arg=30, argval=24, argrepr='to 24', offset=80, start_offset=80, starts_line=False, line_number=7, is_jump_target=False, positions=None), Instruction(opname='JUMP_BACKWARD', opcode=78, arg=30, argval=24, argrepr='to 24', offset=80, start_offset=80, starts_line=False, line_number=7, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=84, start_offset=84, starts_line=True, line_number=8, is_jump_target=True, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=84, start_offset=84, starts_line=True, line_number=8, is_jump_target=True, positions=None),
Instruction(opname='JUMP_FORWARD', opcode=79, arg=12, argval=112, argrepr='to 112', offset=86, start_offset=86, starts_line=False, line_number=8, is_jump_target=False, positions=None), Instruction(opname='JUMP_FORWARD', opcode=80, arg=12, argval=112, argrepr='to 112', offset=86, start_offset=86, starts_line=False, line_number=8, is_jump_target=False, positions=None),
Instruction(opname='END_FOR', opcode=11, arg=None, argval=None, argrepr='', offset=88, start_offset=88, starts_line=True, line_number=3, is_jump_target=True, positions=None), Instruction(opname='END_FOR', opcode=11, arg=None, argval=None, argrepr='', offset=88, start_offset=88, starts_line=True, line_number=3, is_jump_target=True, positions=None),
Instruction(opname='LOAD_GLOBAL', opcode=91, arg=3, argval='print', argrepr='print + NULL', offset=90, start_offset=90, starts_line=True, line_number=10, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=92, arg=3, argval='print', argrepr='print + NULL', offset=90, start_offset=90, starts_line=True, line_number=10, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=4, argval='I can haz else clause?', argrepr="'I can haz else clause?'", offset=100, start_offset=100, starts_line=False, line_number=10, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=4, argval='I can haz else clause?', argrepr="'I can haz else clause?'", offset=100, start_offset=100, starts_line=False, line_number=10, is_jump_target=False, positions=None),
Instruction(opname='CALL', opcode=53, arg=1, argval=1, argrepr='', offset=102, start_offset=102, starts_line=False, line_number=10, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=54, arg=1, argval=1, argrepr='', offset=102, start_offset=102, starts_line=False, line_number=10, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=110, start_offset=110, starts_line=False, line_number=10, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=110, start_offset=110, starts_line=False, line_number=10, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST_CHECK', opcode=87, arg=0, argval='i', argrepr='i', offset=112, start_offset=112, starts_line=True, line_number=11, is_jump_target=True, positions=None), Instruction(opname='LOAD_FAST_CHECK', opcode=88, arg=0, argval='i', argrepr='i', offset=112, start_offset=112, starts_line=True, line_number=11, is_jump_target=True, positions=None),
Instruction(opname='TO_BOOL', opcode=40, arg=None, argval=None, argrepr='', offset=114, start_offset=114, starts_line=False, line_number=11, is_jump_target=False, positions=None), Instruction(opname='TO_BOOL', opcode=40, arg=None, argval=None, argrepr='', offset=114, start_offset=114, starts_line=False, line_number=11, is_jump_target=False, positions=None),
Instruction(opname='POP_JUMP_IF_FALSE', opcode=97, arg=40, argval=206, argrepr='to 206', offset=122, start_offset=122, starts_line=False, line_number=11, is_jump_target=False, positions=None), Instruction(opname='POP_JUMP_IF_FALSE', opcode=98, arg=40, argval=206, argrepr='to 206', offset=122, start_offset=122, starts_line=False, line_number=11, is_jump_target=False, positions=None),
Instruction(opname='LOAD_GLOBAL', opcode=91, arg=3, argval='print', argrepr='print + NULL', offset=126, start_offset=126, starts_line=True, line_number=12, is_jump_target=True, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=92, arg=3, argval='print', argrepr='print + NULL', offset=126, start_offset=126, starts_line=True, line_number=12, is_jump_target=True, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=0, argval='i', argrepr='i', offset=136, start_offset=136, starts_line=False, line_number=12, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=0, argval='i', argrepr='i', offset=136, start_offset=136, starts_line=False, line_number=12, is_jump_target=False, positions=None),
Instruction(opname='CALL', opcode=53, arg=1, argval=1, argrepr='', offset=138, start_offset=138, starts_line=False, line_number=12, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=54, arg=1, argval=1, argrepr='', offset=138, start_offset=138, starts_line=False, line_number=12, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=146, start_offset=146, starts_line=False, line_number=12, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=146, start_offset=146, starts_line=False, line_number=12, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=0, argval='i', argrepr='i', offset=148, start_offset=148, starts_line=True, line_number=13, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=0, argval='i', argrepr='i', offset=148, start_offset=148, starts_line=True, line_number=13, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=5, argval=1, argrepr='1', offset=150, start_offset=150, starts_line=False, line_number=13, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=5, argval=1, argrepr='1', offset=150, start_offset=150, starts_line=False, line_number=13, is_jump_target=False, positions=None),
Instruction(opname='BINARY_OP', opcode=45, arg=23, argval=23, argrepr='-=', offset=152, start_offset=152, starts_line=False, line_number=13, is_jump_target=False, positions=None), Instruction(opname='BINARY_OP', opcode=46, arg=23, argval=23, argrepr='-=', offset=152, start_offset=152, starts_line=False, line_number=13, is_jump_target=False, positions=None),
Instruction(opname='STORE_FAST', opcode=110, arg=0, argval='i', argrepr='i', offset=156, start_offset=156, starts_line=False, line_number=13, is_jump_target=False, positions=None), Instruction(opname='STORE_FAST', opcode=111, arg=0, argval='i', argrepr='i', offset=156, start_offset=156, starts_line=False, line_number=13, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=0, argval='i', argrepr='i', offset=158, start_offset=158, starts_line=True, line_number=14, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=0, argval='i', argrepr='i', offset=158, start_offset=158, starts_line=True, line_number=14, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=3, argval=6, argrepr='6', offset=160, start_offset=160, starts_line=False, line_number=14, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=3, argval=6, argrepr='6', offset=160, start_offset=160, starts_line=False, line_number=14, is_jump_target=False, positions=None),
Instruction(opname='COMPARE_OP', opcode=58, arg=148, argval='>', argrepr='bool(>)', offset=162, start_offset=162, starts_line=False, line_number=14, is_jump_target=False, positions=None), Instruction(opname='COMPARE_OP', opcode=59, arg=148, argval='>', argrepr='bool(>)', offset=162, start_offset=162, starts_line=False, line_number=14, is_jump_target=False, positions=None),
Instruction(opname='POP_JUMP_IF_FALSE', opcode=97, arg=2, argval=174, argrepr='to 174', offset=166, start_offset=166, starts_line=False, line_number=14, is_jump_target=False, positions=None), Instruction(opname='POP_JUMP_IF_FALSE', opcode=98, arg=2, argval=174, argrepr='to 174', offset=166, start_offset=166, starts_line=False, line_number=14, is_jump_target=False, positions=None),
Instruction(opname='JUMP_BACKWARD', opcode=77, arg=31, argval=112, argrepr='to 112', offset=170, start_offset=170, starts_line=True, line_number=15, is_jump_target=False, positions=None), Instruction(opname='JUMP_BACKWARD', opcode=78, arg=31, argval=112, argrepr='to 112', offset=170, start_offset=170, starts_line=True, line_number=15, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=0, argval='i', argrepr='i', offset=174, start_offset=174, starts_line=True, line_number=16, is_jump_target=True, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=0, argval='i', argrepr='i', offset=174, start_offset=174, starts_line=True, line_number=16, is_jump_target=True, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=2, argval=4, argrepr='4', offset=176, start_offset=176, starts_line=False, line_number=16, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=2, argval=4, argrepr='4', offset=176, start_offset=176, starts_line=False, line_number=16, is_jump_target=False, positions=None),
Instruction(opname='COMPARE_OP', opcode=58, arg=18, argval='<', argrepr='bool(<)', offset=178, start_offset=178, starts_line=False, line_number=16, is_jump_target=False, positions=None), Instruction(opname='COMPARE_OP', opcode=59, arg=18, argval='<', argrepr='bool(<)', offset=178, start_offset=178, starts_line=False, line_number=16, is_jump_target=False, positions=None),
Instruction(opname='POP_JUMP_IF_FALSE', opcode=97, arg=1, argval=188, argrepr='to 188', offset=182, start_offset=182, starts_line=False, line_number=16, is_jump_target=False, positions=None), Instruction(opname='POP_JUMP_IF_FALSE', opcode=98, arg=1, argval=188, argrepr='to 188', offset=182, start_offset=182, starts_line=False, line_number=16, is_jump_target=False, positions=None),
Instruction(opname='JUMP_FORWARD', opcode=79, arg=20, argval=228, argrepr='to 228', offset=186, start_offset=186, starts_line=True, line_number=17, is_jump_target=False, positions=None), Instruction(opname='JUMP_FORWARD', opcode=80, arg=20, argval=228, argrepr='to 228', offset=186, start_offset=186, starts_line=True, line_number=17, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=0, argval='i', argrepr='i', offset=188, start_offset=188, starts_line=True, line_number=11, is_jump_target=True, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=0, argval='i', argrepr='i', offset=188, start_offset=188, starts_line=True, line_number=11, is_jump_target=True, positions=None),
Instruction(opname='TO_BOOL', opcode=40, arg=None, argval=None, argrepr='', offset=190, start_offset=190, starts_line=False, line_number=11, is_jump_target=False, positions=None), Instruction(opname='TO_BOOL', opcode=40, arg=None, argval=None, argrepr='', offset=190, start_offset=190, starts_line=False, line_number=11, is_jump_target=False, positions=None),
Instruction(opname='POP_JUMP_IF_FALSE', opcode=97, arg=2, argval=206, argrepr='to 206', offset=198, start_offset=198, starts_line=False, line_number=11, is_jump_target=False, positions=None), Instruction(opname='POP_JUMP_IF_FALSE', opcode=98, arg=2, argval=206, argrepr='to 206', offset=198, start_offset=198, starts_line=False, line_number=11, is_jump_target=False, positions=None),
Instruction(opname='JUMP_BACKWARD', opcode=77, arg=40, argval=126, argrepr='to 126', offset=202, start_offset=202, starts_line=False, line_number=11, is_jump_target=False, positions=None), Instruction(opname='JUMP_BACKWARD', opcode=78, arg=40, argval=126, argrepr='to 126', offset=202, start_offset=202, starts_line=False, line_number=11, is_jump_target=False, positions=None),
Instruction(opname='LOAD_GLOBAL', opcode=91, arg=3, argval='print', argrepr='print + NULL', offset=206, start_offset=206, starts_line=True, line_number=19, is_jump_target=True, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=92, arg=3, argval='print', argrepr='print + NULL', offset=206, start_offset=206, starts_line=True, line_number=19, is_jump_target=True, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=216, start_offset=216, starts_line=False, line_number=19, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=216, start_offset=216, starts_line=False, line_number=19, is_jump_target=False, positions=None),
Instruction(opname='CALL', opcode=53, arg=1, argval=1, argrepr='', offset=218, start_offset=218, starts_line=False, line_number=19, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=54, arg=1, argval=1, argrepr='', offset=218, start_offset=218, starts_line=False, line_number=19, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=226, start_offset=226, starts_line=False, line_number=19, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=226, start_offset=226, starts_line=False, line_number=19, is_jump_target=False, positions=None),
Instruction(opname='NOP', opcode=30, arg=None, argval=None, argrepr='', offset=228, start_offset=228, starts_line=True, line_number=20, is_jump_target=True, positions=None), Instruction(opname='NOP', opcode=30, arg=None, argval=None, argrepr='', offset=228, start_offset=228, starts_line=True, line_number=20, is_jump_target=True, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=5, argval=1, argrepr='1', offset=230, start_offset=230, starts_line=True, line_number=21, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=5, argval=1, argrepr='1', offset=230, start_offset=230, starts_line=True, line_number=21, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=7, argval=0, argrepr='0', offset=232, start_offset=232, starts_line=False, line_number=21, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=7, argval=0, argrepr='0', offset=232, start_offset=232, starts_line=False, line_number=21, is_jump_target=False, positions=None),
Instruction(opname='BINARY_OP', opcode=45, arg=11, argval=11, argrepr='/', offset=234, start_offset=234, starts_line=False, line_number=21, is_jump_target=False, positions=None), Instruction(opname='BINARY_OP', opcode=46, arg=11, argval=11, argrepr='/', offset=234, start_offset=234, starts_line=False, line_number=21, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=238, start_offset=238, starts_line=False, line_number=21, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=238, start_offset=238, starts_line=False, line_number=21, is_jump_target=False, positions=None),
Instruction(opname='LOAD_FAST', opcode=85, arg=0, argval='i', argrepr='i', offset=240, start_offset=240, starts_line=True, line_number=25, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=86, arg=0, argval='i', argrepr='i', offset=240, start_offset=240, starts_line=True, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='BEFORE_WITH', opcode=2, arg=None, argval=None, argrepr='', offset=242, start_offset=242, starts_line=False, line_number=25, is_jump_target=False, positions=None), Instruction(opname='BEFORE_WITH', opcode=2, arg=None, argval=None, argrepr='', offset=242, start_offset=242, starts_line=False, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='STORE_FAST', opcode=110, arg=1, argval='dodgy', argrepr='dodgy', offset=244, start_offset=244, starts_line=False, line_number=25, is_jump_target=False, positions=None), Instruction(opname='STORE_FAST', opcode=111, arg=1, argval='dodgy', argrepr='dodgy', offset=244, start_offset=244, starts_line=False, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='LOAD_GLOBAL', opcode=91, arg=3, argval='print', argrepr='print + NULL', offset=246, start_offset=246, starts_line=True, line_number=26, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=92, arg=3, argval='print', argrepr='print + NULL', offset=246, start_offset=246, starts_line=True, line_number=26, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=8, argval='Never reach this', argrepr="'Never reach this'", offset=256, start_offset=256, starts_line=False, line_number=26, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=8, argval='Never reach this', argrepr="'Never reach this'", offset=256, start_offset=256, starts_line=False, line_number=26, is_jump_target=False, positions=None),
Instruction(opname='CALL', opcode=53, arg=1, argval=1, argrepr='', offset=258, start_offset=258, starts_line=False, line_number=26, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=54, arg=1, argval=1, argrepr='', offset=258, start_offset=258, starts_line=False, line_number=26, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=266, start_offset=266, starts_line=False, line_number=26, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=266, start_offset=266, starts_line=False, line_number=26, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=0, argval=None, argrepr='None', offset=268, start_offset=268, starts_line=True, line_number=25, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=0, argval=None, argrepr='None', offset=268, start_offset=268, starts_line=True, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=0, argval=None, argrepr='None', offset=270, start_offset=270, starts_line=False, line_number=25, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=0, argval=None, argrepr='None', offset=270, start_offset=270, starts_line=False, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=0, argval=None, argrepr='None', offset=272, start_offset=272, starts_line=False, line_number=25, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=0, argval=None, argrepr='None', offset=272, start_offset=272, starts_line=False, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='CALL', opcode=53, arg=2, argval=2, argrepr='', offset=274, start_offset=274, starts_line=False, line_number=25, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=54, arg=2, argval=2, argrepr='', offset=274, start_offset=274, starts_line=False, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=282, start_offset=282, starts_line=False, line_number=25, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=282, start_offset=282, starts_line=False, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='LOAD_GLOBAL', opcode=91, arg=3, argval='print', argrepr='print + NULL', offset=284, start_offset=284, starts_line=True, line_number=28, is_jump_target=True, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=92, arg=3, argval='print', argrepr='print + NULL', offset=284, start_offset=284, starts_line=True, line_number=28, is_jump_target=True, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=294, start_offset=294, starts_line=False, line_number=28, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=294, start_offset=294, starts_line=False, line_number=28, is_jump_target=False, positions=None),
Instruction(opname='CALL', opcode=53, arg=1, argval=1, argrepr='', offset=296, start_offset=296, starts_line=False, line_number=28, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=54, arg=1, argval=1, argrepr='', offset=296, start_offset=296, starts_line=False, line_number=28, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=304, start_offset=304, starts_line=False, line_number=28, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=304, start_offset=304, starts_line=False, line_number=28, is_jump_target=False, positions=None),
Instruction(opname='RETURN_CONST', opcode=103, arg=0, argval=None, argrepr='None', offset=306, start_offset=306, starts_line=False, line_number=28, is_jump_target=False, positions=None), Instruction(opname='RETURN_CONST', opcode=104, arg=0, argval=None, argrepr='None', offset=306, start_offset=306, starts_line=False, line_number=28, is_jump_target=False, positions=None),
Instruction(opname='PUSH_EXC_INFO', opcode=33, arg=None, argval=None, argrepr='', offset=308, start_offset=308, starts_line=True, line_number=25, is_jump_target=False, positions=None), Instruction(opname='PUSH_EXC_INFO', opcode=33, arg=None, argval=None, argrepr='', offset=308, start_offset=308, starts_line=True, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='WITH_EXCEPT_START', opcode=44, arg=None, argval=None, argrepr='', offset=310, start_offset=310, starts_line=False, line_number=25, is_jump_target=False, positions=None), Instruction(opname='WITH_EXCEPT_START', opcode=44, arg=None, argval=None, argrepr='', offset=310, start_offset=310, starts_line=False, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='TO_BOOL', opcode=40, arg=None, argval=None, argrepr='', offset=312, start_offset=312, starts_line=False, line_number=25, is_jump_target=False, positions=None), Instruction(opname='TO_BOOL', opcode=40, arg=None, argval=None, argrepr='', offset=312, start_offset=312, starts_line=False, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='POP_JUMP_IF_TRUE', opcode=100, arg=1, argval=326, argrepr='to 326', offset=320, start_offset=320, starts_line=False, line_number=25, is_jump_target=False, positions=None), Instruction(opname='POP_JUMP_IF_TRUE', opcode=101, arg=1, argval=326, argrepr='to 326', offset=320, start_offset=320, starts_line=False, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='RERAISE', opcode=102, arg=2, argval=2, argrepr='', offset=324, start_offset=324, starts_line=False, line_number=25, is_jump_target=False, positions=None), Instruction(opname='RERAISE', opcode=103, arg=2, argval=2, argrepr='', offset=324, start_offset=324, starts_line=False, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=326, start_offset=326, starts_line=False, line_number=25, is_jump_target=True, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=326, start_offset=326, starts_line=False, line_number=25, is_jump_target=True, positions=None),
Instruction(opname='POP_EXCEPT', opcode=31, arg=None, argval=None, argrepr='', offset=328, start_offset=328, starts_line=False, line_number=25, is_jump_target=False, positions=None), Instruction(opname='POP_EXCEPT', opcode=31, arg=None, argval=None, argrepr='', offset=328, start_offset=328, starts_line=False, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=330, start_offset=330, starts_line=False, line_number=25, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=330, start_offset=330, starts_line=False, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=332, start_offset=332, starts_line=False, line_number=25, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=332, start_offset=332, starts_line=False, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='JUMP_BACKWARD', opcode=77, arg=27, argval=284, argrepr='to 284', offset=334, start_offset=334, starts_line=False, line_number=25, is_jump_target=False, positions=None), Instruction(opname='JUMP_BACKWARD', opcode=78, arg=27, argval=284, argrepr='to 284', offset=334, start_offset=334, starts_line=False, line_number=25, is_jump_target=False, positions=None),
Instruction(opname='COPY', opcode=61, arg=3, argval=3, argrepr='', offset=338, start_offset=338, starts_line=True, line_number=None, is_jump_target=False, positions=None), Instruction(opname='COPY', opcode=62, arg=3, argval=3, argrepr='', offset=338, start_offset=338, starts_line=True, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='POP_EXCEPT', opcode=31, arg=None, argval=None, argrepr='', offset=340, start_offset=340, starts_line=False, line_number=None, is_jump_target=False, positions=None), Instruction(opname='POP_EXCEPT', opcode=31, arg=None, argval=None, argrepr='', offset=340, start_offset=340, starts_line=False, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='RERAISE', opcode=102, arg=1, argval=1, argrepr='', offset=342, start_offset=342, starts_line=False, line_number=None, is_jump_target=False, positions=None), Instruction(opname='RERAISE', opcode=103, arg=1, argval=1, argrepr='', offset=342, start_offset=342, starts_line=False, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='PUSH_EXC_INFO', opcode=33, arg=None, argval=None, argrepr='', offset=344, start_offset=344, starts_line=False, line_number=None, is_jump_target=False, positions=None), Instruction(opname='PUSH_EXC_INFO', opcode=33, arg=None, argval=None, argrepr='', offset=344, start_offset=344, starts_line=False, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='LOAD_GLOBAL', opcode=91, arg=4, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=346, start_offset=346, starts_line=True, line_number=22, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=92, arg=4, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=346, start_offset=346, starts_line=True, line_number=22, is_jump_target=False, positions=None),
Instruction(opname='CHECK_EXC_MATCH', opcode=7, arg=None, argval=None, argrepr='', offset=356, start_offset=356, starts_line=False, line_number=22, is_jump_target=False, positions=None), Instruction(opname='CHECK_EXC_MATCH', opcode=7, arg=None, argval=None, argrepr='', offset=356, start_offset=356, starts_line=False, line_number=22, is_jump_target=False, positions=None),
Instruction(opname='POP_JUMP_IF_FALSE', opcode=97, arg=15, argval=392, argrepr='to 392', offset=358, start_offset=358, starts_line=False, line_number=22, is_jump_target=False, positions=None), Instruction(opname='POP_JUMP_IF_FALSE', opcode=98, arg=15, argval=392, argrepr='to 392', offset=358, start_offset=358, starts_line=False, line_number=22, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=362, start_offset=362, starts_line=False, line_number=22, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=362, start_offset=362, starts_line=False, line_number=22, is_jump_target=False, positions=None),
Instruction(opname='LOAD_GLOBAL', opcode=91, arg=3, argval='print', argrepr='print + NULL', offset=364, start_offset=364, starts_line=True, line_number=23, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=92, arg=3, argval='print', argrepr='print + NULL', offset=364, start_offset=364, starts_line=True, line_number=23, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=9, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=374, start_offset=374, starts_line=False, line_number=23, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=9, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=374, start_offset=374, starts_line=False, line_number=23, is_jump_target=False, positions=None),
Instruction(opname='CALL', opcode=53, arg=1, argval=1, argrepr='', offset=376, start_offset=376, starts_line=False, line_number=23, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=54, arg=1, argval=1, argrepr='', offset=376, start_offset=376, starts_line=False, line_number=23, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=384, start_offset=384, starts_line=False, line_number=23, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=384, start_offset=384, starts_line=False, line_number=23, is_jump_target=False, positions=None),
Instruction(opname='POP_EXCEPT', opcode=31, arg=None, argval=None, argrepr='', offset=386, start_offset=386, starts_line=False, line_number=23, is_jump_target=False, positions=None), Instruction(opname='POP_EXCEPT', opcode=31, arg=None, argval=None, argrepr='', offset=386, start_offset=386, starts_line=False, line_number=23, is_jump_target=False, positions=None),
Instruction(opname='JUMP_BACKWARD', opcode=77, arg=54, argval=284, argrepr='to 284', offset=388, start_offset=388, starts_line=False, line_number=23, is_jump_target=False, positions=None), Instruction(opname='JUMP_BACKWARD', opcode=78, arg=54, argval=284, argrepr='to 284', offset=388, start_offset=388, starts_line=False, line_number=23, is_jump_target=False, positions=None),
Instruction(opname='RERAISE', opcode=102, arg=0, argval=0, argrepr='', offset=392, start_offset=392, starts_line=True, line_number=22, is_jump_target=True, positions=None), Instruction(opname='RERAISE', opcode=103, arg=0, argval=0, argrepr='', offset=392, start_offset=392, starts_line=True, line_number=22, is_jump_target=True, positions=None),
Instruction(opname='COPY', opcode=61, arg=3, argval=3, argrepr='', offset=394, start_offset=394, starts_line=True, line_number=None, is_jump_target=False, positions=None), Instruction(opname='COPY', opcode=62, arg=3, argval=3, argrepr='', offset=394, start_offset=394, starts_line=True, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='POP_EXCEPT', opcode=31, arg=None, argval=None, argrepr='', offset=396, start_offset=396, starts_line=False, line_number=None, is_jump_target=False, positions=None), Instruction(opname='POP_EXCEPT', opcode=31, arg=None, argval=None, argrepr='', offset=396, start_offset=396, starts_line=False, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='RERAISE', opcode=102, arg=1, argval=1, argrepr='', offset=398, start_offset=398, starts_line=False, line_number=None, is_jump_target=False, positions=None), Instruction(opname='RERAISE', opcode=103, arg=1, argval=1, argrepr='', offset=398, start_offset=398, starts_line=False, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='PUSH_EXC_INFO', opcode=33, arg=None, argval=None, argrepr='', offset=400, start_offset=400, starts_line=False, line_number=None, is_jump_target=False, positions=None), Instruction(opname='PUSH_EXC_INFO', opcode=33, arg=None, argval=None, argrepr='', offset=400, start_offset=400, starts_line=False, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='LOAD_GLOBAL', opcode=91, arg=3, argval='print', argrepr='print + NULL', offset=402, start_offset=402, starts_line=True, line_number=28, is_jump_target=False, positions=None), Instruction(opname='LOAD_GLOBAL', opcode=92, arg=3, argval='print', argrepr='print + NULL', offset=402, start_offset=402, starts_line=True, line_number=28, is_jump_target=False, positions=None),
Instruction(opname='LOAD_CONST', opcode=83, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=412, start_offset=412, starts_line=False, line_number=28, is_jump_target=False, positions=None), Instruction(opname='LOAD_CONST', opcode=84, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=412, start_offset=412, starts_line=False, line_number=28, is_jump_target=False, positions=None),
Instruction(opname='CALL', opcode=53, arg=1, argval=1, argrepr='', offset=414, start_offset=414, starts_line=False, line_number=28, is_jump_target=False, positions=None), Instruction(opname='CALL', opcode=54, arg=1, argval=1, argrepr='', offset=414, start_offset=414, starts_line=False, line_number=28, is_jump_target=False, positions=None),
Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=422, start_offset=422, starts_line=False, line_number=28, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=32, arg=None, argval=None, argrepr='', offset=422, start_offset=422, starts_line=False, line_number=28, is_jump_target=False, positions=None),
Instruction(opname='RERAISE', opcode=102, arg=0, argval=0, argrepr='', offset=424, start_offset=424, starts_line=False, line_number=28, is_jump_target=False, positions=None), Instruction(opname='RERAISE', opcode=103, arg=0, argval=0, argrepr='', offset=424, start_offset=424, starts_line=False, line_number=28, is_jump_target=False, positions=None),
Instruction(opname='COPY', opcode=61, arg=3, argval=3, argrepr='', offset=426, start_offset=426, starts_line=True, line_number=None, is_jump_target=False, positions=None), Instruction(opname='COPY', opcode=62, arg=3, argval=3, argrepr='', offset=426, start_offset=426, starts_line=True, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='POP_EXCEPT', opcode=31, arg=None, argval=None, argrepr='', offset=428, start_offset=428, starts_line=False, line_number=None, is_jump_target=False, positions=None), Instruction(opname='POP_EXCEPT', opcode=31, arg=None, argval=None, argrepr='', offset=428, start_offset=428, starts_line=False, line_number=None, is_jump_target=False, positions=None),
Instruction(opname='RERAISE', opcode=102, arg=1, argval=1, argrepr='', offset=430, start_offset=430, starts_line=False, line_number=None, is_jump_target=False, positions=None), Instruction(opname='RERAISE', opcode=103, arg=1, argval=1, argrepr='', offset=430, start_offset=430, starts_line=False, line_number=None, is_jump_target=False, positions=None),
] ]
# One last piece of inspect fodder to check the default line number handling # One last piece of inspect fodder to check the default line number handling
def simple(): pass def simple(): pass
expected_opinfo_simple = [ expected_opinfo_simple = [
Instruction(opname='RESUME', opcode=149, arg=0, argval=0, argrepr='', offset=0, start_offset=0, starts_line=True, line_number=simple.__code__.co_firstlineno, is_jump_target=False, positions=None), Instruction(opname='RESUME', opcode=149, arg=0, argval=0, argrepr='', offset=0, start_offset=0, starts_line=True, line_number=simple.__code__.co_firstlineno, is_jump_target=False, positions=None),
Instruction(opname='RETURN_CONST', opcode=103, arg=0, argval=None, argrepr='None', offset=2, start_offset=2, starts_line=False, line_number=simple.__code__.co_firstlineno, is_jump_target=False), Instruction(opname='RETURN_CONST', opcode=104, arg=0, argval=None, argrepr='None', offset=2, start_offset=2, starts_line=False, line_number=simple.__code__.co_firstlineno, is_jump_target=False),
] ]

View File

@ -0,0 +1,3 @@
Remove ``oparg`` from :opcode:`YIELD_VALUE`. Change ``oparg`` of
:opcode:`RESUME` to include information about the except-depth.
These changes make it possible to simplify the code in generator close.

View File

@ -7,6 +7,7 @@
#include "pycore_frame.h" // FRAME_SPECIALS_SIZE #include "pycore_frame.h" // FRAME_SPECIALS_SIZE
#include "pycore_interp.h" // PyInterpreterState.co_extra_freefuncs #include "pycore_interp.h" // PyInterpreterState.co_extra_freefuncs
#include "pycore_opcode_metadata.h" // _PyOpcode_Deopt, _PyOpcode_Caches #include "pycore_opcode_metadata.h" // _PyOpcode_Deopt, _PyOpcode_Caches
#include "pycore_opcode_utils.h" // RESUME_AT_FUNC_START
#include "pycore_pystate.h" // _PyInterpreterState_GET() #include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "pycore_setobject.h" // _PySet_NextEntry() #include "pycore_setobject.h" // _PySet_NextEntry()
#include "pycore_tuple.h" // _PyTuple_ITEMS() #include "pycore_tuple.h" // _PyTuple_ITEMS()
@ -719,7 +720,7 @@ PyUnstable_Code_New(int argcount, int kwonlyargcount,
// test.test_code.CodeLocationTest.test_code_new_empty to keep it in sync! // test.test_code.CodeLocationTest.test_code_new_empty to keep it in sync!
static const uint8_t assert0[6] = { static const uint8_t assert0[6] = {
RESUME, 0, RESUME, RESUME_AT_FUNC_START,
LOAD_ASSERTION_ERROR, 0, LOAD_ASSERTION_ERROR, 0,
RAISE_VARARGS, 1 RAISE_VARARGS, 1
}; };

View File

@ -343,12 +343,6 @@ is_resume(_Py_CODEUNIT *instr)
); );
} }
static inline bool
is_yield(_Py_CODEUNIT *instr)
{
return instr->op.code == YIELD_VALUE || instr->op.code == INSTRUMENTED_YIELD_VALUE;
}
PyObject * PyObject *
_PyGen_yf(PyGenObject *gen) _PyGen_yf(PyGenObject *gen)
{ {
@ -364,7 +358,8 @@ _PyGen_yf(PyGenObject *gen)
assert(_PyCode_CODE(_PyGen_GetCode(gen))[0].op.code != SEND); assert(_PyCode_CODE(_PyGen_GetCode(gen))[0].op.code != SEND);
return NULL; return NULL;
} }
if (!is_resume(frame->instr_ptr) || frame->instr_ptr->op.arg < RESUME_AFTER_YIELD_FROM) if (!is_resume(frame->instr_ptr) ||
(frame->instr_ptr->op.arg & RESUME_OPARG_LOCATION_MASK) < RESUME_AFTER_YIELD_FROM)
{ {
/* Not in a yield from */ /* Not in a yield from */
return NULL; return NULL;
@ -381,6 +376,7 @@ gen_close(PyGenObject *gen, PyObject *args)
PyObject *retval; PyObject *retval;
int err = 0; int err = 0;
if (gen->gi_frame_state == FRAME_CREATED) { if (gen->gi_frame_state == FRAME_CREATED) {
gen->gi_frame_state = FRAME_COMPLETED; gen->gi_frame_state = FRAME_COMPLETED;
Py_RETURN_NONE; Py_RETURN_NONE;
@ -397,19 +393,14 @@ gen_close(PyGenObject *gen, PyObject *args)
Py_DECREF(yf); Py_DECREF(yf);
} }
_PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe; _PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe;
/* It is possible for the previous instruction to not be a if (is_resume(frame->instr_ptr)) {
* YIELD_VALUE if the debugger has changed the lineno. */
assert(_PyOpcode_Caches[YIELD_VALUE] == 0);
assert(_PyOpcode_Caches[INSTRUMENTED_YIELD_VALUE] == 0);
if (err == 0 && is_yield(frame->instr_ptr - 1)) {
_Py_CODEUNIT *yield_instr = frame->instr_ptr - 1;
assert(is_resume(frame->instr_ptr));
int exception_handler_depth = yield_instr->op.arg;
assert(exception_handler_depth > 0);
/* We can safely ignore the outermost try block /* We can safely ignore the outermost try block
* as it automatically generated to handle * as it is automatically generated to handle
* StopIteration. */ * StopIteration. */
if (exception_handler_depth == 1) { int oparg = frame->instr_ptr->op.arg;
if (oparg & RESUME_OPARG_DEPTH1_MASK) {
// RESUME after YIELD_VALUE and exception depth is 1
assert((oparg & RESUME_OPARG_LOCATION_MASK) != RESUME_AT_FUNC_START);
gen->gi_frame_state = FRAME_COMPLETED; gen->gi_frame_state = FRAME_COMPLETED;
Py_RETURN_NONE; Py_RETURN_NONE;
} }

View File

@ -1,17 +1,17 @@
// Auto-generated by Programs/freeze_test_frozenmain.py // Auto-generated by Programs/freeze_test_frozenmain.py
unsigned char M_test_frozenmain[] = { unsigned char M_test_frozenmain[] = {
227,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0, 227,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,
0,0,0,0,0,243,164,0,0,0,149,0,83,0,83,1, 0,0,0,0,0,243,164,0,0,0,149,0,84,0,84,1,
75,0,114,0,83,0,83,1,75,1,114,1,92,2,34,0, 76,0,115,0,84,0,84,1,76,1,115,1,93,2,34,0,
83,2,53,1,0,0,0,0,0,0,32,0,92,2,34,0, 84,2,54,1,0,0,0,0,0,0,32,0,93,2,34,0,
83,3,92,0,82,6,0,0,0,0,0,0,0,0,0,0, 84,3,93,0,83,6,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,53,2,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,54,2,0,0,0,0,0,0,
32,0,92,1,82,8,0,0,0,0,0,0,0,0,0,0, 32,0,93,1,83,8,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,34,0,53,0,0,0,0,0, 0,0,0,0,0,0,0,0,34,0,54,0,0,0,0,0,
0,0,83,4,5,0,0,0,114,5,83,5,19,0,72,20, 0,0,84,4,5,0,0,0,115,5,84,5,19,0,73,20,
0,0,114,6,92,2,34,0,83,6,92,6,14,0,83,7, 0,0,115,6,93,2,34,0,84,6,93,6,14,0,84,7,
92,5,92,6,5,0,0,0,14,0,51,4,53,1,0,0, 93,5,93,6,5,0,0,0,14,0,52,4,54,1,0,0,
0,0,0,0,32,0,77,22,0,0,11,0,103,1,41,8, 0,0,0,0,32,0,78,22,0,0,11,0,104,1,41,8,
233,0,0,0,0,78,122,18,70,114,111,122,101,110,32,72, 233,0,0,0,0,78,122,18,70,114,111,122,101,110,32,72,
101,108,108,111,32,87,111,114,108,100,122,8,115,121,115,46, 101,108,108,111,32,87,111,114,108,100,122,8,115,121,115,46,
97,114,103,118,218,6,99,111,110,102,105,103,41,5,218,12, 97,114,103,118,218,6,99,111,110,102,105,103,41,5,218,12,

View File

@ -149,7 +149,7 @@ dummy_func(
next_instr = this_instr; next_instr = this_instr;
} }
else { else {
if (oparg < RESUME_AFTER_YIELD_FROM) { if ((oparg & RESUME_OPARG_LOCATION_MASK) < RESUME_AFTER_YIELD_FROM) {
CHECK_EVAL_BREAKER(); CHECK_EVAL_BREAKER();
} }
this_instr->op.code = RESUME_CHECK; this_instr->op.code = RESUME_CHECK;
@ -177,7 +177,7 @@ dummy_func(
next_instr = this_instr; next_instr = this_instr;
} }
else { else {
if (oparg < 2) { if ((oparg & RESUME_OPARG_LOCATION_MASK) < RESUME_AFTER_YIELD_FROM) {
CHECK_EVAL_BREAKER(); CHECK_EVAL_BREAKER();
} }
_PyFrame_SetStackPointer(frame, stack_pointer); _PyFrame_SetStackPointer(frame, stack_pointer);
@ -1047,7 +1047,6 @@ dummy_func(
inst(INSTRUMENTED_YIELD_VALUE, (retval -- unused)) { inst(INSTRUMENTED_YIELD_VALUE, (retval -- unused)) {
assert(frame != &entry_frame); assert(frame != &entry_frame);
assert(oparg >= 0); /* make the generator identify this as HAS_ARG */
frame->instr_ptr = next_instr; frame->instr_ptr = next_instr;
PyGenObject *gen = _PyFrame_GetGenerator(frame); PyGenObject *gen = _PyFrame_GetGenerator(frame);
gen->gi_frame_state = FRAME_SUSPENDED; gen->gi_frame_state = FRAME_SUSPENDED;
@ -1073,7 +1072,6 @@ dummy_func(
// NOTE: It's important that YIELD_VALUE never raises an exception! // NOTE: It's important that YIELD_VALUE never raises an exception!
// The compiler treats any exception raised here as a failed close() // The compiler treats any exception raised here as a failed close()
// or throw() call. // or throw() call.
assert(oparg >= 0); /* make the generator identify this as HAS_ARG */
assert(frame != &entry_frame); assert(frame != &entry_frame);
frame->instr_ptr = next_instr; frame->instr_ptr = next_instr;
PyGenObject *gen = _PyFrame_GetGenerator(frame); PyGenObject *gen = _PyFrame_GetGenerator(frame);

View File

@ -642,7 +642,7 @@ static const _Py_CODEUNIT _Py_INTERPRETER_TRAMPOLINE_INSTRUCTIONS[] = {
{ .op.code = INTERPRETER_EXIT, .op.arg = 0 }, /* reached on return */ { .op.code = INTERPRETER_EXIT, .op.arg = 0 }, /* reached on return */
{ .op.code = NOP, .op.arg = 0 }, { .op.code = NOP, .op.arg = 0 },
{ .op.code = INTERPRETER_EXIT, .op.arg = 0 }, /* reached on yield */ { .op.code = INTERPRETER_EXIT, .op.arg = 0 }, /* reached on yield */
{ .op.code = RESUME, .op.arg = RESUME_AT_FUNC_START } { .op.code = RESUME, .op.arg = RESUME_OPARG_DEPTH1_MASK | RESUME_AT_FUNC_START }
}; };
extern const struct _PyCode_DEF(8) _Py_InitCleanup; extern const struct _PyCode_DEF(8) _Py_InitCleanup;

View File

@ -1549,7 +1549,7 @@ compiler_add_yield_from(struct compiler *c, location loc, int await)
// Set up a virtual try/except to handle when StopIteration is raised during // Set up a virtual try/except to handle when StopIteration is raised during
// a close or throw call. The only way YIELD_VALUE raises if they do! // a close or throw call. The only way YIELD_VALUE raises if they do!
ADDOP_JUMP(c, loc, SETUP_FINALLY, fail); ADDOP_JUMP(c, loc, SETUP_FINALLY, fail);
ADDOP_I(c, loc, YIELD_VALUE, 0); ADDOP(c, loc, YIELD_VALUE);
ADDOP(c, NO_LOCATION, POP_BLOCK); ADDOP(c, NO_LOCATION, POP_BLOCK);
ADDOP_I(c, loc, RESUME, await ? RESUME_AFTER_AWAIT : RESUME_AFTER_YIELD_FROM); ADDOP_I(c, loc, RESUME, await ? RESUME_AFTER_AWAIT : RESUME_AFTER_YIELD_FROM);
ADDOP_JUMP(c, loc, JUMP_NO_INTERRUPT, send); ADDOP_JUMP(c, loc, JUMP_NO_INTERRUPT, send);
@ -4159,7 +4159,7 @@ addop_yield(struct compiler *c, location loc) {
if (c->u->u_ste->ste_generator && c->u->u_ste->ste_coroutine) { if (c->u->u_ste->ste_generator && c->u->u_ste->ste_coroutine) {
ADDOP_I(c, loc, CALL_INTRINSIC_1, INTRINSIC_ASYNC_GEN_WRAP); ADDOP_I(c, loc, CALL_INTRINSIC_1, INTRINSIC_ASYNC_GEN_WRAP);
} }
ADDOP_I(c, loc, YIELD_VALUE, 0); ADDOP(c, loc, YIELD_VALUE);
ADDOP_I(c, loc, RESUME, RESUME_AFTER_YIELD); ADDOP_I(c, loc, RESUME, RESUME_AFTER_YIELD);
return SUCCESS; return SUCCESS;
} }

View File

@ -840,6 +840,7 @@ label_exception_targets(basicblock *entryblock) {
assert(except_stack != NULL); assert(except_stack != NULL);
b->b_exceptstack = NULL; b->b_exceptstack = NULL;
handler = except_stack_top(except_stack); handler = except_stack_top(except_stack);
int last_yield_except_depth = -1;
for (int i = 0; i < b->b_iused; i++) { for (int i = 0; i < b->b_iused; i++) {
cfg_instr *instr = &b->b_instr[i]; cfg_instr *instr = &b->b_instr[i];
if (is_block_push(instr)) { if (is_block_push(instr)) {
@ -878,10 +879,21 @@ label_exception_targets(basicblock *entryblock) {
todo++; todo++;
} }
} }
else { else if (instr->i_opcode == YIELD_VALUE) {
if (instr->i_opcode == YIELD_VALUE) { instr->i_except = handler;
instr->i_oparg = except_stack->depth; last_yield_except_depth = except_stack->depth;
}
else if (instr->i_opcode == RESUME) {
instr->i_except = handler;
if (instr->i_oparg != RESUME_AT_FUNC_START) {
assert(last_yield_except_depth >= 0);
if (last_yield_except_depth == 1) {
instr->i_oparg |= RESUME_OPARG_DEPTH1_MASK;
}
last_yield_except_depth = -1;
} }
}
else {
instr->i_except = handler; instr->i_except = handler;
} }
} }

View File

@ -35,7 +35,7 @@
next_instr = this_instr; next_instr = this_instr;
} }
else { else {
if (oparg < RESUME_AFTER_YIELD_FROM) { if ((oparg & RESUME_OPARG_LOCATION_MASK) < RESUME_AFTER_YIELD_FROM) {
CHECK_EVAL_BREAKER(); CHECK_EVAL_BREAKER();
} }
this_instr->op.code = RESUME_CHECK; this_instr->op.code = RESUME_CHECK;
@ -71,7 +71,7 @@
next_instr = this_instr; next_instr = this_instr;
} }
else { else {
if (oparg < 2) { if ((oparg & RESUME_OPARG_LOCATION_MASK) < RESUME_AFTER_YIELD_FROM) {
CHECK_EVAL_BREAKER(); CHECK_EVAL_BREAKER();
} }
_PyFrame_SetStackPointer(frame, stack_pointer); _PyFrame_SetStackPointer(frame, stack_pointer);
@ -1499,7 +1499,6 @@
PyObject *retval; PyObject *retval;
retval = stack_pointer[-1]; retval = stack_pointer[-1];
assert(frame != &entry_frame); assert(frame != &entry_frame);
assert(oparg >= 0); /* make the generator identify this as HAS_ARG */
frame->instr_ptr = next_instr; frame->instr_ptr = next_instr;
PyGenObject *gen = _PyFrame_GetGenerator(frame); PyGenObject *gen = _PyFrame_GetGenerator(frame);
gen->gi_frame_state = FRAME_SUSPENDED; gen->gi_frame_state = FRAME_SUSPENDED;
@ -1530,7 +1529,6 @@
// NOTE: It's important that YIELD_VALUE never raises an exception! // NOTE: It's important that YIELD_VALUE never raises an exception!
// The compiler treats any exception raised here as a failed close() // The compiler treats any exception raised here as a failed close()
// or throw() call. // or throw() call.
assert(oparg >= 0); /* make the generator identify this as HAS_ARG */
assert(frame != &entry_frame); assert(frame != &entry_frame);
frame->instr_ptr = next_instr; frame->instr_ptr = next_instr;
PyGenObject *gen = _PyFrame_GetGenerator(frame); PyGenObject *gen = _PyFrame_GetGenerator(frame);

View File

@ -44,6 +44,7 @@ static void *opcode_targets[256] = {
&&TARGET_UNARY_NEGATIVE, &&TARGET_UNARY_NEGATIVE,
&&TARGET_UNARY_NOT, &&TARGET_UNARY_NOT,
&&TARGET_WITH_EXCEPT_START, &&TARGET_WITH_EXCEPT_START,
&&TARGET_YIELD_VALUE,
&&TARGET_BINARY_OP, &&TARGET_BINARY_OP,
&&TARGET_BUILD_CONST_KEY_MAP, &&TARGET_BUILD_CONST_KEY_MAP,
&&TARGET_BUILD_LIST, &&TARGET_BUILD_LIST,
@ -117,7 +118,6 @@ static void *opcode_targets[256] = {
&&TARGET_SWAP, &&TARGET_SWAP,
&&TARGET_UNPACK_EX, &&TARGET_UNPACK_EX,
&&TARGET_UNPACK_SEQUENCE, &&TARGET_UNPACK_SEQUENCE,
&&TARGET_YIELD_VALUE,
&&_unknown_opcode, &&_unknown_opcode,
&&_unknown_opcode, &&_unknown_opcode,
&&_unknown_opcode, &&_unknown_opcode,