@@ -740,7 +740,7 @@ async def async_def():
740
740
Argument count: 0
741
741
Kw-only arguments: 0
742
742
Number of locals: 2
743
- Stack size: 10
743
+ Stack size: 9
744
744
Flags: OPTIMIZED, NEWLOCALS, NOFREE, COROUTINE
745
745
Constants:
746
746
0: None
@@ -966,7 +966,7 @@ def jumpy():
966
966
Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 6 , argval = 'Who let lolcatz into this test suite?' , argrepr = "'Who let lolcatz into this test suite?'" , offset = 96 , starts_line = None , is_jump_target = False ),
967
967
Instruction (opname = 'CALL_FUNCTION' , opcode = 131 , arg = 1 , argval = 1 , argrepr = '' , offset = 98 , starts_line = None , is_jump_target = False ),
968
968
Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 100 , starts_line = None , is_jump_target = False ),
969
- Instruction (opname = 'SETUP_FINALLY' , opcode = 122 , arg = 70 , argval = 174 , argrepr = 'to 174 ' , offset = 102 , starts_line = 20 , is_jump_target = True ),
969
+ Instruction (opname = 'SETUP_FINALLY' , opcode = 122 , arg = 90 , argval = 194 , argrepr = 'to 194 ' , offset = 102 , starts_line = 20 , is_jump_target = True ),
970
970
Instruction (opname = 'SETUP_FINALLY' , opcode = 122 , arg = 12 , argval = 118 , argrepr = 'to 118' , offset = 104 , starts_line = None , is_jump_target = False ),
971
971
Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 5 , argval = 1 , argrepr = '1' , offset = 106 , starts_line = 21 , is_jump_target = False ),
972
972
Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 7 , argval = 0 , argrepr = '0' , offset = 108 , starts_line = None , is_jump_target = False ),
@@ -986,29 +986,39 @@ def jumpy():
986
986
Instruction (opname = 'CALL_FUNCTION' , opcode = 131 , arg = 1 , argval = 1 , argrepr = '' , offset = 136 , starts_line = None , is_jump_target = False ),
987
987
Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 138 , starts_line = None , is_jump_target = False ),
988
988
Instruction (opname = 'POP_EXCEPT' , opcode = 89 , arg = None , argval = None , argrepr = '' , offset = 140 , starts_line = None , is_jump_target = False ),
989
- Instruction (opname = 'JUMP_FORWARD' , opcode = 110 , arg = 26 , argval = 170 , argrepr = 'to 170 ' , offset = 142 , starts_line = None , is_jump_target = False ),
989
+ Instruction (opname = 'JUMP_FORWARD' , opcode = 110 , arg = 46 , argval = 190 , argrepr = 'to 190 ' , offset = 142 , starts_line = None , is_jump_target = False ),
990
990
Instruction (opname = 'END_FINALLY' , opcode = 88 , arg = None , argval = None , argrepr = '' , offset = 144 , starts_line = None , is_jump_target = True ),
991
991
Instruction (opname = 'LOAD_FAST' , opcode = 124 , arg = 0 , argval = 'i' , argrepr = 'i' , offset = 146 , starts_line = 25 , is_jump_target = True ),
992
- Instruction (opname = 'SETUP_WITH' , opcode = 143 , arg = 14 , argval = 164 , argrepr = 'to 164 ' , offset = 148 , starts_line = None , is_jump_target = False ),
992
+ Instruction (opname = 'SETUP_WITH' , opcode = 143 , arg = 24 , argval = 174 , argrepr = 'to 174 ' , offset = 148 , starts_line = None , is_jump_target = False ),
993
993
Instruction (opname = 'STORE_FAST' , opcode = 125 , arg = 1 , argval = 'dodgy' , argrepr = 'dodgy' , offset = 150 , starts_line = None , is_jump_target = False ),
994
994
Instruction (opname = 'LOAD_GLOBAL' , opcode = 116 , arg = 1 , argval = 'print' , argrepr = 'print' , offset = 152 , starts_line = 26 , is_jump_target = False ),
995
995
Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 9 , argval = 'Never reach this' , argrepr = "'Never reach this'" , offset = 154 , starts_line = None , is_jump_target = False ),
996
996
Instruction (opname = 'CALL_FUNCTION' , opcode = 131 , arg = 1 , argval = 1 , argrepr = '' , offset = 156 , starts_line = None , is_jump_target = False ),
997
997
Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 158 , starts_line = None , is_jump_target = False ),
998
998
Instruction (opname = 'POP_BLOCK' , opcode = 87 , arg = None , argval = None , argrepr = '' , offset = 160 , starts_line = None , is_jump_target = False ),
999
- Instruction (opname = 'BEGIN_FINALLY' , opcode = 53 , arg = None , argval = None , argrepr = '' , offset = 162 , starts_line = None , is_jump_target = False ),
1000
- Instruction (opname = 'WITH_CLEANUP_START' , opcode = 81 , arg = None , argval = None , argrepr = '' , offset = 164 , starts_line = None , is_jump_target = True ),
1001
- Instruction (opname = 'WITH_CLEANUP_FINISH' , opcode = 82 , arg = None , argval = None , argrepr = '' , offset = 166 , starts_line = None , is_jump_target = False ),
1002
- Instruction (opname = 'END_FINALLY' , opcode = 88 , arg = None , argval = None , argrepr = '' , offset = 168 , starts_line = None , is_jump_target = False ),
1003
- Instruction (opname = 'POP_BLOCK' , opcode = 87 , arg = None , argval = None , argrepr = '' , offset = 170 , starts_line = None , is_jump_target = True ),
1004
- Instruction (opname = 'BEGIN_FINALLY' , opcode = 53 , arg = None , argval = None , argrepr = '' , offset = 172 , starts_line = None , is_jump_target = False ),
1005
- Instruction (opname = 'LOAD_GLOBAL' , opcode = 116 , arg = 1 , argval = 'print' , argrepr = 'print' , offset = 174 , starts_line = 28 , is_jump_target = True ),
1006
- Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 10 , argval = "OK, now we're done" , argrepr = '"OK, now we\' re done"' , offset = 176 , starts_line = None , is_jump_target = False ),
1007
- Instruction (opname = 'CALL_FUNCTION' , opcode = 131 , arg = 1 , argval = 1 , argrepr = '' , offset = 178 , starts_line = None , is_jump_target = False ),
1008
- Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 180 , starts_line = None , is_jump_target = False ),
1009
- Instruction (opname = 'END_FINALLY' , opcode = 88 , arg = None , argval = None , argrepr = '' , offset = 182 , starts_line = None , is_jump_target = False ),
1010
- Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 0 , argval = None , argrepr = 'None' , offset = 184 , starts_line = None , is_jump_target = False ),
1011
- Instruction (opname = 'RETURN_VALUE' , opcode = 83 , arg = None , argval = None , argrepr = '' , offset = 186 , starts_line = None , is_jump_target = False ),
999
+ Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 0 , argval = None , argrepr = 'None' , offset = 162 , starts_line = None , is_jump_target = False ),
1000
+ Instruction (opname = 'DUP_TOP' , opcode = 4 , arg = None , argval = None , argrepr = '' , offset = 164 , starts_line = None , is_jump_target = False ),
1001
+ Instruction (opname = 'DUP_TOP' , opcode = 4 , arg = None , argval = None , argrepr = '' , offset = 166 , starts_line = None , is_jump_target = False ),
1002
+ Instruction (opname = 'CALL_FUNCTION' , opcode = 131 , arg = 3 , argval = 3 , argrepr = '' , offset = 168 , starts_line = None , is_jump_target = False ),
1003
+ Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 170 , starts_line = None , is_jump_target = False ),
1004
+ Instruction (opname = 'JUMP_FORWARD' , opcode = 110 , arg = 16 , argval = 190 , argrepr = 'to 190' , offset = 172 , starts_line = None , is_jump_target = False ),
1005
+ Instruction (opname = 'WITH_EXCEPT_START' , opcode = 54 , arg = None , argval = None , argrepr = '' , offset = 174 , starts_line = None , is_jump_target = True ),
1006
+ Instruction (opname = 'POP_JUMP_IF_TRUE' , opcode = 115 , arg = 180 , argval = 180 , argrepr = '' , offset = 176 , starts_line = None , is_jump_target = False ),
1007
+ Instruction (opname = 'RERAISE' , opcode = 48 , arg = None , argval = None , argrepr = '' , offset = 178 , starts_line = None , is_jump_target = False ),
1008
+ Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 180 , starts_line = None , is_jump_target = True ),
1009
+ Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 182 , starts_line = None , is_jump_target = False ),
1010
+ Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 184 , starts_line = None , is_jump_target = False ),
1011
+ Instruction (opname = 'POP_EXCEPT' , opcode = 89 , arg = None , argval = None , argrepr = '' , offset = 186 , starts_line = None , is_jump_target = False ),
1012
+ Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 188 , starts_line = None , is_jump_target = False ),
1013
+ Instruction (opname = 'POP_BLOCK' , opcode = 87 , arg = None , argval = None , argrepr = '' , offset = 190 , starts_line = None , is_jump_target = True ),
1014
+ Instruction (opname = 'BEGIN_FINALLY' , opcode = 53 , arg = None , argval = None , argrepr = '' , offset = 192 , starts_line = None , is_jump_target = False ),
1015
+ Instruction (opname = 'LOAD_GLOBAL' , opcode = 116 , arg = 1 , argval = 'print' , argrepr = 'print' , offset = 194 , starts_line = 28 , is_jump_target = True ),
1016
+ Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 10 , argval = "OK, now we're done" , argrepr = '"OK, now we\' re done"' , offset = 196 , starts_line = None , is_jump_target = False ),
1017
+ Instruction (opname = 'CALL_FUNCTION' , opcode = 131 , arg = 1 , argval = 1 , argrepr = '' , offset = 198 , starts_line = None , is_jump_target = False ),
1018
+ Instruction (opname = 'POP_TOP' , opcode = 1 , arg = None , argval = None , argrepr = '' , offset = 200 , starts_line = None , is_jump_target = False ),
1019
+ Instruction (opname = 'END_FINALLY' , opcode = 88 , arg = None , argval = None , argrepr = '' , offset = 202 , starts_line = None , is_jump_target = False ),
1020
+ Instruction (opname = 'LOAD_CONST' , opcode = 100 , arg = 0 , argval = None , argrepr = 'None' , offset = 204 , starts_line = None , is_jump_target = False ),
1021
+ Instruction (opname = 'RETURN_VALUE' , opcode = 83 , arg = None , argval = None , argrepr = '' , offset = 206 , starts_line = None , is_jump_target = False )
1012
1022
]
1013
1023
1014
1024
# One last piece of inspect fodder to check the default line number handling
@@ -1021,6 +1031,10 @@ def simple(): pass
1021
1031
1022
1032
class InstructionTests (BytecodeTestCase ):
1023
1033
1034
+ def __init__ (self , * args ):
1035
+ super ().__init__ (* args )
1036
+ self .maxDiff = None
1037
+
1024
1038
def test_default_first_line (self ):
1025
1039
actual = dis .get_instructions (simple )
1026
1040
self .assertEqual (list (actual ), expected_opinfo_simple )
@@ -1052,6 +1066,7 @@ def test_jumpy(self):
1052
1066
# get_instructions has its own tests above, so can rely on it to validate
1053
1067
# the object oriented API
1054
1068
class BytecodeTests (unittest .TestCase ):
1069
+
1055
1070
def test_instantiation (self ):
1056
1071
# Test with function, method, code string and code object
1057
1072
for obj in [_f , _C (1 ).__init__ , "a=1" , _f .__code__ ]:
0 commit comments