@@ -459,16 +459,17 @@ def foo(x):
459459
460460dis_nested_1 = """%s
461461Disassembly of <code object foo at 0x..., file "%s", line %d>:
462- 0 MAKE_CELL 0 (x)
463-
464- %3d 2 LOAD_CLOSURE 0 (x)
465- 4 BUILD_TUPLE 1
466- 6 LOAD_CONST 1 (<code object <listcomp> at 0x..., file "%s", line %d>)
467- 8 MAKE_FUNCTION 8 (closure)
468- 10 LOAD_DEREF 1 (y)
469- 12 GET_ITER
470- 14 CALL_FUNCTION 1
471- 16 RETURN_VALUE
462+ 0 COPY_FREE_VARS 1
463+ 2 MAKE_CELL 0 (x)
464+
465+ %3d 4 LOAD_CLOSURE 0 (x)
466+ 6 BUILD_TUPLE 1
467+ 8 LOAD_CONST 1 (<code object <listcomp> at 0x..., file "%s", line %d>)
468+ 10 MAKE_FUNCTION 8 (closure)
469+ 12 LOAD_DEREF 1 (y)
470+ 14 GET_ITER
471+ 16 CALL_FUNCTION 1
472+ 18 RETURN_VALUE
472473""" % (dis_nested_0 ,
473474 __file__ ,
474475 _h .__code__ .co_firstlineno + 1 ,
@@ -479,16 +480,18 @@ def foo(x):
479480
480481dis_nested_2 = """%s
481482Disassembly of <code object <listcomp> at 0x..., file "%s", line %d>:
482- %3d 0 BUILD_LIST 0
483- 2 LOAD_FAST 0 (.0)
484- >> 4 FOR_ITER 6 (to 18)
485- 6 STORE_FAST 1 (z)
486- 8 LOAD_DEREF 2 (x)
487- 10 LOAD_FAST 1 (z)
488- 12 BINARY_OP 0 (+)
489- 14 LIST_APPEND 2
490- 16 JUMP_ABSOLUTE 2 (to 4)
491- >> 18 RETURN_VALUE
483+ 0 COPY_FREE_VARS 1
484+
485+ %3d 2 BUILD_LIST 0
486+ 4 LOAD_FAST 0 (.0)
487+ >> 6 FOR_ITER 6 (to 20)
488+ 8 STORE_FAST 1 (z)
489+ 10 LOAD_DEREF 2 (x)
490+ 12 LOAD_FAST 1 (z)
491+ 14 BINARY_OP 0 (+)
492+ 16 LIST_APPEND 2
493+ 18 JUMP_ABSOLUTE 3 (to 6)
494+ >> 20 RETURN_VALUE
492495""" % (dis_nested_1 ,
493496 __file__ ,
494497 _h .__code__ .co_firstlineno + 3 ,
@@ -1007,42 +1010,43 @@ def _prepare_test_cases():
10071010 Instruction (opname = 'RETURN_VALUE' , opcode = 83 , arg = None , argval = None , argrepr = '' , offset = 40 , starts_line = None , is_jump_target = False , positions = None ),
10081011]
10091012
1010-
10111013expected_opinfo_f = [
1012- Instruction (opname = 'MAKE_CELL' , opcode = 135 , arg = 0 , argval = 'c' , argrepr = 'c' , offset = 0 , starts_line = None , is_jump_target = False , positions = None ),
1013- Instruction (opname = 'MAKE_CELL' , opcode = 135 , arg = 1 , argval = 'd' , argrepr = 'd' , offset = 2 , starts_line = None , is_jump_target = False , positions = None ),
1014- Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 4 , argval = (5 , 6 ), argrepr = '(5, 6)' , offset = 4 , starts_line = 3 , is_jump_target = False , positions = None ),
1015- Instruction (opname = 'LOAD_CLOSURE' , opcode = 136 , arg = 3 , argval = 'a' , argrepr = 'a' , offset = 6 , starts_line = None , is_jump_target = False , positions = None ),
1016- Instruction (opname = 'LOAD_CLOSURE' , opcode = 136 , arg = 4 , argval = 'b' , argrepr = 'b' , offset = 8 , starts_line = None , is_jump_target = False , positions = None ),
1017- Instruction (opname = 'LOAD_CLOSURE' , opcode = 136 , arg = 0 , argval = 'c' , argrepr = 'c' , offset = 10 , starts_line = None , is_jump_target = False , positions = None ),
1018- Instruction (opname = 'LOAD_CLOSURE' , opcode = 136 , arg = 1 , argval = 'd' , argrepr = 'd' , offset = 12 , starts_line = None , is_jump_target = False , positions = None ),
1019- Instruction (opname = 'BUILD_TUPLE' , opcode = 102 , arg = 4 , argval = 4 , argrepr = '' , offset = 14 , starts_line = None , is_jump_target = False , positions = None ),
1020- Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 3 , argval = code_object_inner , argrepr = repr (code_object_inner ), offset = 16 , starts_line = None , is_jump_target = False , positions = None ),
1021- Instruction (opname = 'MAKE_FUNCTION' , opcode = 132 , arg = 9 , argval = 9 , argrepr = 'defaults, closure' , offset = 18 , starts_line = None , is_jump_target = False , positions = None ),
1022- Instruction (opname = 'STORE_FAST' , opcode = 125 , arg = 2 , argval = 'inner' , argrepr = 'inner' , offset = 20 , starts_line = None , is_jump_target = False , positions = None ),
1023- Instruction (opname = 'LOAD_GLOBAL' , opcode = 116 , arg = 0 , argval = 'print' , argrepr = 'print' , offset = 22 , starts_line = 5 , is_jump_target = False , positions = None ),
1024- Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 3 , argval = 'a' , argrepr = 'a' , offset = 24 , starts_line = None , is_jump_target = False , positions = None ),
1025- Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 4 , argval = 'b' , argrepr = 'b' , offset = 26 , starts_line = None , is_jump_target = False , positions = None ),
1026- Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 0 , argval = 'c' , argrepr = 'c' , offset = 28 , starts_line = None , is_jump_target = False , positions = None ),
1027- Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 1 , argval = 'd' , argrepr = 'd' , offset = 30 , starts_line = None , is_jump_target = False , positions = None ),
1028- Instruction (opname = 'CALL_FUNCTION' , opcode = 131 , arg = 4 , argval = 4 , argrepr = '' , offset = 32 , starts_line = None , is_jump_target = False , positions = None ),
1029- Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 34 , starts_line = None , is_jump_target = False , positions = None ),
1030- Instruction (opname = 'LOAD_FAST' , opcode = 124 , arg = 2 , argval = 'inner' , argrepr = 'inner' , offset = 36 , starts_line = 6 , is_jump_target = False , positions = None ),
1031- Instruction (opname = 'RETURN_VALUE' , opcode = 83 , arg = None , argval = None , argrepr = '' , offset = 38 , starts_line = None , is_jump_target = False , positions = None ),
1014+ Instruction (opname = 'COPY_FREE_VARS' , opcode = 149 , arg = 2 , argval = 2 , argrepr = '' , offset = 0 , starts_line = None , is_jump_target = False , positions = None ),
1015+ Instruction (opname = 'MAKE_CELL' , opcode = 135 , arg = 0 , argval = 'c' , argrepr = 'c' , offset = 2 , starts_line = None , is_jump_target = False , positions = None ),
1016+ Instruction (opname = 'MAKE_CELL' , opcode = 135 , arg = 1 , argval = 'd' , argrepr = 'd' , offset = 4 , starts_line = None , is_jump_target = False , positions = None ),
1017+ Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 4 , argval = (5 , 6 ), argrepr = '(5, 6)' , offset = 6 , starts_line = 3 , is_jump_target = False , positions = None ),
1018+ Instruction (opname = 'LOAD_CLOSURE' , opcode = 136 , arg = 3 , argval = 'a' , argrepr = 'a' , offset = 8 , starts_line = None , is_jump_target = False , positions = None ),
1019+ Instruction (opname = 'LOAD_CLOSURE' , opcode = 136 , arg = 4 , argval = 'b' , argrepr = 'b' , offset = 10 , starts_line = None , is_jump_target = False , positions = None ),
1020+ Instruction (opname = 'LOAD_CLOSURE' , opcode = 136 , arg = 0 , argval = 'c' , argrepr = 'c' , offset = 12 , starts_line = None , is_jump_target = False , positions = None ),
1021+ Instruction (opname = 'LOAD_CLOSURE' , opcode = 136 , arg = 1 , argval = 'd' , argrepr = 'd' , offset = 14 , starts_line = None , is_jump_target = False , positions = None ),
1022+ Instruction (opname = 'BUILD_TUPLE' , opcode = 102 , arg = 4 , argval = 4 , argrepr = '' , offset = 16 , starts_line = None , is_jump_target = False , positions = None ),
1023+ Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 3 , argval = code_object_inner , argrepr = repr (code_object_inner ), offset = 18 , starts_line = None , is_jump_target = False , positions = None ),
1024+ Instruction (opname = 'MAKE_FUNCTION' , opcode = 132 , arg = 9 , argval = 9 , argrepr = 'defaults, closure' , offset = 20 , starts_line = None , is_jump_target = False , positions = None ),
1025+ Instruction (opname = 'STORE_FAST' , opcode = 125 , arg = 2 , argval = 'inner' , argrepr = 'inner' , offset = 22 , starts_line = None , is_jump_target = False , positions = None ),
1026+ Instruction (opname = 'LOAD_GLOBAL' , opcode = 116 , arg = 0 , argval = 'print' , argrepr = 'print' , offset = 24 , starts_line = 5 , is_jump_target = False , positions = None ),
1027+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 3 , argval = 'a' , argrepr = 'a' , offset = 26 , starts_line = None , is_jump_target = False , positions = None ),
1028+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 4 , argval = 'b' , argrepr = 'b' , offset = 28 , starts_line = None , is_jump_target = False , positions = None ),
1029+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 0 , argval = 'c' , argrepr = 'c' , offset = 30 , starts_line = None , is_jump_target = False , positions = None ),
1030+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 1 , argval = 'd' , argrepr = 'd' , offset = 32 , starts_line = None , is_jump_target = False , positions = None ),
1031+ Instruction (opname = 'CALL_FUNCTION' , opcode = 131 , arg = 4 , argval = 4 , argrepr = '' , offset = 34 , starts_line = None , is_jump_target = False , positions = None ),
1032+ Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 36 , starts_line = None , is_jump_target = False , positions = None ),
1033+ Instruction (opname = 'LOAD_FAST' , opcode = 124 , arg = 2 , argval = 'inner' , argrepr = 'inner' , offset = 38 , starts_line = 6 , is_jump_target = False , positions = None ),
1034+ Instruction (opname = 'RETURN_VALUE' , opcode = 83 , arg = None , argval = None , argrepr = '' , offset = 40 , starts_line = None , is_jump_target = False , positions = None ),
10321035]
10331036
10341037expected_opinfo_inner = [
1035- Instruction (opname = 'LOAD_GLOBAL' , opcode = 116 , arg = 0 , argval = 'print' , argrepr = 'print' , offset = 0 , starts_line = 4 , is_jump_target = False , positions = None ),
1036- Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 2 , argval = 'a' , argrepr = 'a' , offset = 2 , starts_line = None , is_jump_target = False , positions = None ),
1037- Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 3 , argval = 'b' , argrepr = 'b' , offset = 4 , starts_line = None , is_jump_target = False , positions = None ),
1038- Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 4 , argval = 'c' , argrepr = 'c' , offset = 6 , starts_line = None , is_jump_target = False , positions = None ),
1039- Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 5 , argval = 'd' , argrepr = 'd' , offset = 8 , starts_line = None , is_jump_target = False , positions = None ),
1040- Instruction (opname = 'LOAD_FAST' , opcode = 124 , arg = 0 , argval = 'e' , argrepr = 'e' , offset = 10 , starts_line = None , is_jump_target = False , positions = None ),
1041- Instruction (opname = 'LOAD_FAST' , opcode = 124 , arg = 1 , argval = 'f' , argrepr = 'f' , offset = 12 , starts_line = None , is_jump_target = False , positions = None ),
1042- Instruction (opname = 'CALL_FUNCTION' , opcode = 131 , arg = 6 , argval = 6 , argrepr = '' , offset = 14 , starts_line = None , is_jump_target = False , positions = None ),
1043- Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 16 , starts_line = None , is_jump_target = False , positions = None ),
1044- Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 0 , argval = None , argrepr = 'None' , offset = 18 , starts_line = None , is_jump_target = False , positions = None ),
1045- Instruction (opname = 'RETURN_VALUE' , opcode = 83 , arg = None , argval = None , argrepr = '' , offset = 20 , starts_line = None , is_jump_target = False , positions = None ),
1038+ Instruction (opname = 'COPY_FREE_VARS' , opcode = 149 , arg = 4 , argval = 4 , argrepr = '' , offset = 0 , starts_line = None , is_jump_target = False , positions = None ),
1039+ Instruction (opname = 'LOAD_GLOBAL' , opcode = 116 , arg = 0 , argval = 'print' , argrepr = 'print' , offset = 2 , starts_line = 4 , is_jump_target = False , positions = None ),
1040+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 2 , argval = 'a' , argrepr = 'a' , offset = 4 , starts_line = None , is_jump_target = False , positions = None ),
1041+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 3 , argval = 'b' , argrepr = 'b' , offset = 6 , starts_line = None , is_jump_target = False , positions = None ),
1042+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 4 , argval = 'c' , argrepr = 'c' , offset = 8 , starts_line = None , is_jump_target = False , positions = None ),
1043+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 5 , argval = 'd' , argrepr = 'd' , offset = 10 , starts_line = None , is_jump_target = False , positions = None ),
1044+ Instruction (opname = 'LOAD_FAST' , opcode = 124 , arg = 0 , argval = 'e' , argrepr = 'e' , offset = 12 , starts_line = None , is_jump_target = False , positions = None ),
1045+ Instruction (opname = 'LOAD_FAST' , opcode = 124 , arg = 1 , argval = 'f' , argrepr = 'f' , offset = 14 , starts_line = None , is_jump_target = False , positions = None ),
1046+ Instruction (opname = 'CALL_FUNCTION' , opcode = 131 , arg = 6 , argval = 6 , argrepr = '' , offset = 16 , starts_line = None , is_jump_target = False , positions = None ),
1047+ Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 18 , starts_line = None , is_jump_target = False , positions = None ),
1048+ Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 0 , argval = None , argrepr = 'None' , offset = 20 , starts_line = None , is_jump_target = False , positions = None ),
1049+ Instruction (opname = 'RETURN_VALUE' , opcode = 83 , arg = None , argval = None , argrepr = '' , offset = 22 , starts_line = None , is_jump_target = False , positions = None ),
10461050]
10471051
10481052expected_opinfo_jumpy = [
0 commit comments