@@ -427,15 +427,17 @@ def foo(x):
427
427
return foo
428
428
429
429
dis_nested_0 = """\
430
- %3d 0 LOAD_CLOSURE 2 (y)
431
- 2 BUILD_TUPLE 1
432
- 4 LOAD_CONST 1 (<code object foo at 0x..., file "%s", line %d>)
433
- 6 LOAD_CONST 2 ('_h.<locals>.foo')
434
- 8 MAKE_FUNCTION 8 (closure)
435
- 10 STORE_FAST 1 (foo)
436
-
437
- %3d 12 LOAD_FAST 1 (foo)
438
- 14 RETURN_VALUE
430
+ 0 MAKE_CELL 2 (y)
431
+
432
+ %3d 2 LOAD_CLOSURE 2 (y)
433
+ 4 BUILD_TUPLE 1
434
+ 6 LOAD_CONST 1 (<code object foo at 0x..., file "%s", line %d>)
435
+ 8 LOAD_CONST 2 ('_h.<locals>.foo')
436
+ 10 MAKE_FUNCTION 8 (closure)
437
+ 12 STORE_FAST 1 (foo)
438
+
439
+ %3d 14 LOAD_FAST 1 (foo)
440
+ 16 RETURN_VALUE
439
441
""" % (_h .__code__ .co_firstlineno + 1 ,
440
442
__file__ ,
441
443
_h .__code__ .co_firstlineno + 1 ,
@@ -444,15 +446,17 @@ def foo(x):
444
446
445
447
dis_nested_1 = """%s
446
448
Disassembly of <code object foo at 0x..., file "%s", line %d>:
447
- %3d 0 LOAD_CLOSURE 1 (x)
448
- 2 BUILD_TUPLE 1
449
- 4 LOAD_CONST 1 (<code object <listcomp> at 0x..., file "%s", line %d>)
450
- 6 LOAD_CONST 2 ('_h.<locals>.foo.<locals>.<listcomp>')
451
- 8 MAKE_FUNCTION 8 (closure)
452
- 10 LOAD_DEREF 2 (y)
453
- 12 GET_ITER
454
- 14 CALL_FUNCTION 1
455
- 16 RETURN_VALUE
449
+ 0 MAKE_CELL 1 (x)
450
+
451
+ %3d 2 LOAD_CLOSURE 1 (x)
452
+ 4 BUILD_TUPLE 1
453
+ 6 LOAD_CONST 1 (<code object <listcomp> at 0x..., file "%s", line %d>)
454
+ 8 LOAD_CONST 2 ('_h.<locals>.foo.<locals>.<listcomp>')
455
+ 10 MAKE_FUNCTION 8 (closure)
456
+ 12 LOAD_DEREF 2 (y)
457
+ 14 GET_ITER
458
+ 16 CALL_FUNCTION 1
459
+ 18 RETURN_VALUE
456
460
""" % (dis_nested_0 ,
457
461
__file__ ,
458
462
_h .__code__ .co_firstlineno + 1 ,
@@ -958,59 +962,64 @@ def jumpy():
958
962
#print('expected_opinfo_jumpy = [\n ',
959
963
#',\n '.join(map(str, _instructions)), ',\n]', sep='')
960
964
965
+ #dis.dis(outer)
961
966
962
967
Instruction = dis .Instruction
963
968
expected_opinfo_outer = [
964
- Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 8 , argval = (3 , 4 ), argrepr = '(3, 4)' , offset = 0 , starts_line = 2 , is_jump_target = False ),
965
- Instruction (opname = 'LOAD_CLOSURE' , opcode = 135 , arg = 3 , argval = 'a' , argrepr = 'a' , offset = 2 , starts_line = None , is_jump_target = False ),
966
- Instruction (opname = 'LOAD_CLOSURE' , opcode = 135 , arg = 4 , argval = 'b' , argrepr = 'b' , offset = 4 , starts_line = None , is_jump_target = False ),
967
- Instruction (opname = 'BUILD_TUPLE' , opcode = 102 , arg = 2 , argval = 2 , argrepr = '' , offset = 6 , starts_line = None , is_jump_target = False ),
968
- Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 3 , argval = code_object_f , argrepr = repr (code_object_f ), offset = 8 , starts_line = None , is_jump_target = False ),
969
- Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 4 , argval = 'outer.<locals>.f' , argrepr = "'outer.<locals>.f'" , offset = 10 , starts_line = None , is_jump_target = False ),
970
- Instruction (opname = 'MAKE_FUNCTION' , opcode = 132 , arg = 9 , argval = 9 , argrepr = 'defaults, closure' , offset = 12 , starts_line = None , is_jump_target = False ),
971
- Instruction (opname = 'STORE_FAST' , opcode = 125 , arg = 2 , argval = 'f' , argrepr = 'f' , offset = 14 , starts_line = None , is_jump_target = False ),
972
- Instruction (opname = 'LOAD_GLOBAL' , opcode = 116 , arg = 0 , argval = 'print' , argrepr = 'print' , offset = 16 , starts_line = 7 , is_jump_target = False ),
973
- Instruction (opname = 'LOAD_DEREF' , opcode = 136 , arg = 3 , argval = 'a' , argrepr = 'a' , offset = 18 , starts_line = None , is_jump_target = False ),
974
- Instruction (opname = 'LOAD_DEREF' , opcode = 136 , arg = 4 , argval = 'b' , argrepr = 'b' , offset = 20 , starts_line = None , is_jump_target = False ),
975
- Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 5 , argval = '' , argrepr = "''" , offset = 22 , starts_line = None , is_jump_target = False ),
976
- Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 6 , argval = 1 , argrepr = '1' , offset = 24 , starts_line = None , is_jump_target = False ),
977
- Instruction (opname = 'BUILD_LIST' , opcode = 103 , arg = 0 , argval = 0 , argrepr = '' , offset = 26 , starts_line = None , is_jump_target = False ),
978
- Instruction (opname = 'BUILD_MAP' , opcode = 105 , arg = 0 , argval = 0 , argrepr = '' , offset = 28 , starts_line = None , is_jump_target = False ),
979
- Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 7 , argval = 'Hello world!' , argrepr = "'Hello world!'" , offset = 30 , starts_line = None , is_jump_target = False ),
980
- Instruction (opname = 'CALL_FUNCTION' , opcode = 131 , arg = 7 , argval = 7 , argrepr = '' , offset = 32 , starts_line = None , is_jump_target = False ),
981
- Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 34 , starts_line = None , is_jump_target = False ),
982
- Instruction (opname = 'LOAD_FAST' , opcode = 124 , arg = 2 , argval = 'f' , argrepr = 'f' , offset = 36 , starts_line = 8 , is_jump_target = False ),
983
- Instruction (opname = 'RETURN_VALUE' , opcode = 83 , arg = None , argval = None , argrepr = '' , offset = 38 , starts_line = None , is_jump_target = False ),
969
+ Instruction (opname = 'MAKE_CELL' , opcode = 135 , arg = 3 , argval = 'a' , argrepr = 'a' , offset = 0 , starts_line = None , is_jump_target = False ),
970
+ Instruction (opname = 'MAKE_CELL' , opcode = 135 , arg = 4 , argval = 'b' , argrepr = 'b' , offset = 2 , starts_line = None , is_jump_target = False ),
971
+ Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 8 , argval = (3 , 4 ), argrepr = '(3, 4)' , offset = 4 , starts_line = 2 , is_jump_target = False ),
972
+ Instruction (opname = 'LOAD_CLOSURE' , opcode = 136 , arg = 3 , argval = 'a' , argrepr = 'a' , offset = 6 , starts_line = None , is_jump_target = False ),
973
+ Instruction (opname = 'LOAD_CLOSURE' , opcode = 136 , arg = 4 , argval = 'b' , argrepr = 'b' , offset = 8 , starts_line = None , is_jump_target = False ),
974
+ Instruction (opname = 'BUILD_TUPLE' , opcode = 102 , arg = 2 , argval = 2 , argrepr = '' , offset = 10 , starts_line = None , is_jump_target = False ),
975
+ Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 3 , argval = code_object_f , argrepr = repr (code_object_f ), offset = 12 , starts_line = None , is_jump_target = False ),
976
+ Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 4 , argval = 'outer.<locals>.f' , argrepr = "'outer.<locals>.f'" , offset = 14 , starts_line = None , is_jump_target = False ),
977
+ Instruction (opname = 'MAKE_FUNCTION' , opcode = 132 , arg = 9 , argval = 9 , argrepr = 'defaults, closure' , offset = 16 , starts_line = None , is_jump_target = False ),
978
+ Instruction (opname = 'STORE_FAST' , opcode = 125 , arg = 2 , argval = 'f' , argrepr = 'f' , offset = 18 , starts_line = None , is_jump_target = False ),
979
+ Instruction (opname = 'LOAD_GLOBAL' , opcode = 116 , arg = 0 , argval = 'print' , argrepr = 'print' , offset = 20 , starts_line = 7 , is_jump_target = False ),
980
+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 3 , argval = 'a' , argrepr = 'a' , offset = 22 , starts_line = None , is_jump_target = False ),
981
+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 4 , argval = 'b' , argrepr = 'b' , offset = 24 , starts_line = None , is_jump_target = False ),
982
+ Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 5 , argval = '' , argrepr = "''" , offset = 26 , starts_line = None , is_jump_target = False ),
983
+ Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 6 , argval = 1 , argrepr = '1' , offset = 28 , starts_line = None , is_jump_target = False ),
984
+ Instruction (opname = 'BUILD_LIST' , opcode = 103 , arg = 0 , argval = 0 , argrepr = '' , offset = 30 , starts_line = None , is_jump_target = False ),
985
+ Instruction (opname = 'BUILD_MAP' , opcode = 105 , arg = 0 , argval = 0 , argrepr = '' , offset = 32 , starts_line = None , is_jump_target = False ),
986
+ Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 7 , argval = 'Hello world!' , argrepr = "'Hello world!'" , offset = 34 , starts_line = None , is_jump_target = False ),
987
+ Instruction (opname = 'CALL_FUNCTION' , opcode = 131 , arg = 7 , argval = 7 , argrepr = '' , offset = 36 , starts_line = None , is_jump_target = False ),
988
+ Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 38 , starts_line = None , is_jump_target = False ),
989
+ Instruction (opname = 'LOAD_FAST' , opcode = 124 , arg = 2 , argval = 'f' , argrepr = 'f' , offset = 40 , starts_line = 8 , is_jump_target = False ),
990
+ Instruction (opname = 'RETURN_VALUE' , opcode = 83 , arg = None , argval = None , argrepr = '' , offset = 42 , starts_line = None , is_jump_target = False ),
984
991
]
985
992
986
993
expected_opinfo_f = [
987
- Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 5 , argval = (5 , 6 ), argrepr = '(5, 6)' , offset = 0 , starts_line = 3 , is_jump_target = False ),
988
- Instruction (opname = 'LOAD_CLOSURE' , opcode = 135 , arg = 5 , argval = 'a' , argrepr = 'a' , offset = 2 , starts_line = None , is_jump_target = False ),
989
- Instruction (opname = 'LOAD_CLOSURE' , opcode = 135 , arg = 6 , argval = 'b' , argrepr = 'b' , offset = 4 , starts_line = None , is_jump_target = False ),
990
- Instruction (opname = 'LOAD_CLOSURE' , opcode = 135 , arg = 3 , argval = 'c' , argrepr = 'c' , offset = 6 , starts_line = None , is_jump_target = False ),
991
- Instruction (opname = 'LOAD_CLOSURE' , opcode = 135 , arg = 4 , argval = 'd' , argrepr = 'd' , offset = 8 , starts_line = None , is_jump_target = False ),
992
- Instruction (opname = 'BUILD_TUPLE' , opcode = 102 , arg = 4 , argval = 4 , argrepr = '' , offset = 10 , starts_line = None , is_jump_target = False ),
993
- Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 3 , argval = code_object_inner , argrepr = repr (code_object_inner ), offset = 12 , starts_line = None , is_jump_target = False ),
994
- Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 4 , argval = 'outer.<locals>.f.<locals>.inner' , argrepr = "'outer.<locals>.f.<locals>.inner'" , offset = 14 , starts_line = None , is_jump_target = False ),
995
- Instruction (opname = 'MAKE_FUNCTION' , opcode = 132 , arg = 9 , argval = 9 , argrepr = 'defaults, closure' , offset = 16 , starts_line = None , is_jump_target = False ),
996
- Instruction (opname = 'STORE_FAST' , opcode = 125 , arg = 2 , argval = 'inner' , argrepr = 'inner' , offset = 18 , starts_line = None , is_jump_target = False ),
997
- Instruction (opname = 'LOAD_GLOBAL' , opcode = 116 , arg = 0 , argval = 'print' , argrepr = 'print' , offset = 20 , starts_line = 5 , is_jump_target = False ),
998
- Instruction (opname = 'LOAD_DEREF' , opcode = 136 , arg = 5 , argval = 'a' , argrepr = 'a' , offset = 22 , starts_line = None , is_jump_target = False ),
999
- Instruction (opname = 'LOAD_DEREF' , opcode = 136 , arg = 6 , argval = 'b' , argrepr = 'b' , offset = 24 , starts_line = None , is_jump_target = False ),
1000
- Instruction (opname = 'LOAD_DEREF' , opcode = 136 , arg = 3 , argval = 'c' , argrepr = 'c' , offset = 26 , starts_line = None , is_jump_target = False ),
1001
- Instruction (opname = 'LOAD_DEREF' , opcode = 136 , arg = 4 , argval = 'd' , argrepr = 'd' , offset = 28 , starts_line = None , is_jump_target = False ),
1002
- Instruction (opname = 'CALL_FUNCTION' , opcode = 131 , arg = 4 , argval = 4 , argrepr = '' , offset = 30 , starts_line = None , is_jump_target = False ),
1003
- Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 32 , starts_line = None , is_jump_target = False ),
1004
- Instruction (opname = 'LOAD_FAST' , opcode = 124 , arg = 2 , argval = 'inner' , argrepr = 'inner' , offset = 34 , starts_line = 6 , is_jump_target = False ),
1005
- Instruction (opname = 'RETURN_VALUE' , opcode = 83 , arg = None , argval = None , argrepr = '' , offset = 36 , starts_line = None , is_jump_target = False ),
994
+ Instruction (opname = 'MAKE_CELL' , opcode = 135 , arg = 3 , argval = 'c' , argrepr = 'c' , offset = 0 , starts_line = None , is_jump_target = False ),
995
+ Instruction (opname = 'MAKE_CELL' , opcode = 135 , arg = 4 , argval = 'd' , argrepr = 'd' , offset = 2 , starts_line = None , is_jump_target = False ),
996
+ Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 5 , argval = (5 , 6 ), argrepr = '(5, 6)' , offset = 4 , starts_line = 3 , is_jump_target = False ),
997
+ Instruction (opname = 'LOAD_CLOSURE' , opcode = 136 , arg = 5 , argval = 'a' , argrepr = 'a' , offset = 6 , starts_line = None , is_jump_target = False ),
998
+ Instruction (opname = 'LOAD_CLOSURE' , opcode = 136 , arg = 6 , argval = 'b' , argrepr = 'b' , offset = 8 , starts_line = None , is_jump_target = False ),
999
+ Instruction (opname = 'LOAD_CLOSURE' , opcode = 136 , arg = 3 , argval = 'c' , argrepr = 'c' , offset = 10 , starts_line = None , is_jump_target = False ),
1000
+ Instruction (opname = 'LOAD_CLOSURE' , opcode = 136 , arg = 4 , argval = 'd' , argrepr = 'd' , offset = 12 , starts_line = None , is_jump_target = False ),
1001
+ Instruction (opname = 'BUILD_TUPLE' , opcode = 102 , arg = 4 , argval = 4 , argrepr = '' , offset = 14 , starts_line = None , is_jump_target = False ),
1002
+ 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 ),
1003
+ Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 4 , argval = 'outer.<locals>.f.<locals>.inner' , argrepr = "'outer.<locals>.f.<locals>.inner'" , offset = 18 , starts_line = None , is_jump_target = False ),
1004
+ Instruction (opname = 'MAKE_FUNCTION' , opcode = 132 , arg = 9 , argval = 9 , argrepr = 'defaults, closure' , offset = 20 , starts_line = None , is_jump_target = False ),
1005
+ Instruction (opname = 'STORE_FAST' , opcode = 125 , arg = 2 , argval = 'inner' , argrepr = 'inner' , offset = 22 , starts_line = None , is_jump_target = False ),
1006
+ Instruction (opname = 'LOAD_GLOBAL' , opcode = 116 , arg = 0 , argval = 'print' , argrepr = 'print' , offset = 24 , starts_line = 5 , is_jump_target = False ),
1007
+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 5 , argval = 'a' , argrepr = 'a' , offset = 26 , starts_line = None , is_jump_target = False ),
1008
+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 6 , argval = 'b' , argrepr = 'b' , offset = 28 , starts_line = None , is_jump_target = False ),
1009
+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 3 , argval = 'c' , argrepr = 'c' , offset = 30 , starts_line = None , is_jump_target = False ),
1010
+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 4 , argval = 'd' , argrepr = 'd' , offset = 32 , starts_line = None , is_jump_target = False ),
1011
+ Instruction (opname = 'CALL_FUNCTION' , opcode = 131 , arg = 4 , argval = 4 , argrepr = '' , offset = 34 , starts_line = None , is_jump_target = False ),
1012
+ Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 36 , starts_line = None , is_jump_target = False ),
1013
+ Instruction (opname = 'LOAD_FAST' , opcode = 124 , arg = 2 , argval = 'inner' , argrepr = 'inner' , offset = 38 , starts_line = 6 , is_jump_target = False ),
1014
+ Instruction (opname = 'RETURN_VALUE' , opcode = 83 , arg = None , argval = None , argrepr = '' , offset = 40 , starts_line = None , is_jump_target = False ),
1006
1015
]
1007
1016
1008
1017
expected_opinfo_inner = [
1009
1018
Instruction (opname = 'LOAD_GLOBAL' , opcode = 116 , arg = 0 , argval = 'print' , argrepr = 'print' , offset = 0 , starts_line = 4 , is_jump_target = False ),
1010
- Instruction (opname = 'LOAD_DEREF' , opcode = 136 , arg = 2 , argval = 'a' , argrepr = 'a' , offset = 2 , starts_line = None , is_jump_target = False ),
1011
- Instruction (opname = 'LOAD_DEREF' , opcode = 136 , arg = 3 , argval = 'b' , argrepr = 'b' , offset = 4 , starts_line = None , is_jump_target = False ),
1012
- Instruction (opname = 'LOAD_DEREF' , opcode = 136 , arg = 4 , argval = 'c' , argrepr = 'c' , offset = 6 , starts_line = None , is_jump_target = False ),
1013
- Instruction (opname = 'LOAD_DEREF' , opcode = 136 , arg = 5 , argval = 'd' , argrepr = 'd' , offset = 8 , starts_line = None , is_jump_target = False ),
1019
+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 2 , argval = 'a' , argrepr = 'a' , offset = 2 , starts_line = None , is_jump_target = False ),
1020
+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 3 , argval = 'b' , argrepr = 'b' , offset = 4 , starts_line = None , is_jump_target = False ),
1021
+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 4 , argval = 'c' , argrepr = 'c' , offset = 6 , starts_line = None , is_jump_target = False ),
1022
+ Instruction (opname = 'LOAD_DEREF' , opcode = 137 , arg = 5 , argval = 'd' , argrepr = 'd' , offset = 8 , starts_line = None , is_jump_target = False ),
1014
1023
Instruction (opname = 'LOAD_FAST' , opcode = 124 , arg = 0 , argval = 'e' , argrepr = 'e' , offset = 10 , starts_line = None , is_jump_target = False ),
1015
1024
Instruction (opname = 'LOAD_FAST' , opcode = 124 , arg = 1 , argval = 'f' , argrepr = 'f' , offset = 12 , starts_line = None , is_jump_target = False ),
1016
1025
Instruction (opname = 'CALL_FUNCTION' , opcode = 131 , arg = 6 , argval = 6 , argrepr = '' , offset = 14 , starts_line = None , is_jump_target = False ),
0 commit comments