Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(28919)

Delta Between Two Patch Sets: Lib/test/test_dis.py

Issue 27095: Simplify MAKE_FUNCTION
Left Patch Set: Created 3 years, 3 months ago
Right Patch Set: Created 3 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 # Minimal tests for dis module 1 # Minimal tests for dis module
2 2
3 from test.support import captured_stdout 3 from test.support import captured_stdout
4 from test.bytecode_helper import BytecodeTestCase 4 from test.bytecode_helper import BytecodeTestCase
5 import difflib 5 import difflib
6 import unittest 6 import unittest
7 import sys 7 import sys
8 import dis 8 import dis
9 import io 9 import io
10 import re 10 import re
(...skipping 22 matching lines...) Expand all
33 @staticmethod 33 @staticmethod
34 def sm(x): 34 def sm(x):
35 x = x == 1 35 x = x == 1
36 36
37 @classmethod 37 @classmethod
38 def cm(cls, x): 38 def cm(cls, x):
39 cls.x = x == 1 39 cls.x = x == 1
40 40
41 dis_c_instance_method = """\ 41 dis_c_instance_method = """\
42 %3d 0 LOAD_FAST 1 (x) 42 %3d 0 LOAD_FAST 1 (x)
43 3 LOAD_CONST 1 (1) 43 2 LOAD_CONST 1 (1)
44 6 COMPARE_OP 2 (==) 44 4 COMPARE_OP 2 (==)
45 9 LOAD_FAST 0 (self) 45 6 LOAD_FAST 0 (self)
46 12 STORE_ATTR 0 (x) 46 8 STORE_ATTR 0 (x)
47 15 LOAD_CONST 0 (None) 47 10 LOAD_CONST 0 (None)
48 18 RETURN_VALUE 48 12 RETURN_VALUE
49 """ % (_C.__init__.__code__.co_firstlineno + 1,) 49 """ % (_C.__init__.__code__.co_firstlineno + 1,)
50 50
51 dis_c_instance_method_bytes = """\ 51 dis_c_instance_method_bytes = """\
52 0 LOAD_FAST 1 (1) 52 0 LOAD_FAST 1 (1)
53 3 LOAD_CONST 1 (1) 53 2 LOAD_CONST 1 (1)
54 6 COMPARE_OP 2 (==) 54 4 COMPARE_OP 2 (==)
55 9 LOAD_FAST 0 (0) 55 6 LOAD_FAST 0 (0)
56 12 STORE_ATTR 0 (0) 56 8 STORE_ATTR 0 (0)
57 15 LOAD_CONST 0 (0) 57 10 LOAD_CONST 0 (0)
58 18 RETURN_VALUE 58 12 RETURN_VALUE
59 """ 59 """
60 60
61 dis_c_class_method = """\ 61 dis_c_class_method = """\
62 %3d 0 LOAD_FAST 1 (x) 62 %3d 0 LOAD_FAST 1 (x)
63 3 LOAD_CONST 1 (1) 63 2 LOAD_CONST 1 (1)
64 6 COMPARE_OP 2 (==) 64 4 COMPARE_OP 2 (==)
65 9 LOAD_FAST 0 (cls) 65 6 LOAD_FAST 0 (cls)
66 12 STORE_ATTR 0 (x) 66 8 STORE_ATTR 0 (x)
67 15 LOAD_CONST 0 (None) 67 10 LOAD_CONST 0 (None)
68 18 RETURN_VALUE 68 12 RETURN_VALUE
69 """ % (_C.cm.__code__.co_firstlineno + 2,) 69 """ % (_C.cm.__code__.co_firstlineno + 2,)
70 70
71 dis_c_static_method = """\ 71 dis_c_static_method = """\
72 %3d 0 LOAD_FAST 0 (x) 72 %3d 0 LOAD_FAST 0 (x)
73 3 LOAD_CONST 1 (1) 73 2 LOAD_CONST 1 (1)
74 6 COMPARE_OP 2 (==) 74 4 COMPARE_OP 2 (==)
75 9 STORE_FAST 0 (x) 75 6 STORE_FAST 0 (x)
76 12 LOAD_CONST 0 (None) 76 8 LOAD_CONST 0 (None)
77 15 RETURN_VALUE 77 10 RETURN_VALUE
78 """ % (_C.sm.__code__.co_firstlineno + 2,) 78 """ % (_C.sm.__code__.co_firstlineno + 2,)
79 79
80 # Class disassembling info has an extra newline at end. 80 # Class disassembling info has an extra newline at end.
81 dis_c = """\ 81 dis_c = """\
82 Disassembly of %s: 82 Disassembly of %s:
83 %s 83 %s
84 Disassembly of %s: 84 Disassembly of %s:
85 %s 85 %s
86 Disassembly of %s: 86 Disassembly of %s:
87 %s 87 %s
88 """ % (_C.__init__.__name__, dis_c_instance_method, 88 """ % (_C.__init__.__name__, dis_c_instance_method,
89 _C.cm.__name__, dis_c_class_method, 89 _C.cm.__name__, dis_c_class_method,
90 _C.sm.__name__, dis_c_static_method) 90 _C.sm.__name__, dis_c_static_method)
91 91
92 def _f(a): 92 def _f(a):
93 print(a) 93 print(a)
94 return 1 94 return 1
95 95
96 dis_f = """\ 96 dis_f = """\
97 %3d 0 LOAD_GLOBAL 0 (print) 97 %3d 0 LOAD_GLOBAL 0 (print)
98 3 LOAD_FAST 0 (a) 98 2 LOAD_FAST 0 (a)
99 6 CALL_FUNCTION 1 (1 positional, 0 keyword pair) 99 4 CALL_FUNCTION 1 (1 positional, 0 keyword pair)
100 9 POP_TOP 100 6 POP_TOP
101 101
102 %3d 10 LOAD_CONST 1 (1) 102 %3d 8 LOAD_CONST 1 (1)
103 13 RETURN_VALUE 103 10 RETURN_VALUE
104 """ % (_f.__code__.co_firstlineno + 1, 104 """ % (_f.__code__.co_firstlineno + 1,
105 _f.__code__.co_firstlineno + 2) 105 _f.__code__.co_firstlineno + 2)
106 106
107 107
108 dis_f_co_code = """\ 108 dis_f_co_code = """\
109 0 LOAD_GLOBAL 0 (0) 109 0 LOAD_GLOBAL 0 (0)
110 3 LOAD_FAST 0 (0) 110 2 LOAD_FAST 0 (0)
111 6 CALL_FUNCTION 1 (1 positional, 0 keyword pair) 111 4 CALL_FUNCTION 1 (1 positional, 0 keyword pair)
112 9 POP_TOP 112 6 POP_TOP
113 10 LOAD_CONST 1 (1) 113 8 LOAD_CONST 1 (1)
114 13 RETURN_VALUE 114 10 RETURN_VALUE
115 """ 115 """
116 116
117 117
118 def bug708901(): 118 def bug708901():
119 for res in range(1, 119 for res in range(1,
120 10): 120 10):
121 pass 121 pass
122 122
123 dis_bug708901 = """\ 123 dis_bug708901 = """\
124 %3d 0 SETUP_LOOP 23 (to 26) 124 %3d 0 SETUP_LOOP 18 (to 20)
125 3 LOAD_GLOBAL 0 (range) 125 2 LOAD_GLOBAL 0 (range)
126 6 LOAD_CONST 1 (1) 126 4 LOAD_CONST 1 (1)
127 127
128 %3d 9 LOAD_CONST 2 (10) 128 %3d 6 LOAD_CONST 2 (10)
129 12 CALL_FUNCTION 2 (2 positional, 0 keyword pair) 129 8 CALL_FUNCTION 2 (2 positional, 0 keyword pair)
130 15 GET_ITER 130 10 GET_ITER
131 >> 16 FOR_ITER 6 (to 25) 131 >> 12 FOR_ITER 4 (to 18)
132 19 STORE_FAST 0 (res) 132 14 STORE_FAST 0 (res)
133 133
134 %3d 22 JUMP_ABSOLUTE 16 134 %3d 16 JUMP_ABSOLUTE 12
135 >> 25 POP_BLOCK 135 >> 18 POP_BLOCK
136 >> 26 LOAD_CONST 0 (None) 136 >> 20 LOAD_CONST 0 (None)
137 29 RETURN_VALUE 137 22 RETURN_VALUE
138 """ % (bug708901.__code__.co_firstlineno + 1, 138 """ % (bug708901.__code__.co_firstlineno + 1,
139 bug708901.__code__.co_firstlineno + 2, 139 bug708901.__code__.co_firstlineno + 2,
140 bug708901.__code__.co_firstlineno + 3) 140 bug708901.__code__.co_firstlineno + 3)
141 141
142 142
143 def bug1333982(x=[]): 143 def bug1333982(x=[]):
144 assert 0, ([s for s in x] + 144 assert 0, ([s for s in x] +
145 1) 145 1)
146 pass 146 pass
147 147
148 dis_bug1333982 = """\ 148 dis_bug1333982 = """\
149 %3d 0 LOAD_CONST 1 (0) 149 %3d 0 LOAD_CONST 1 (0)
150 3 POP_JUMP_IF_TRUE 35 150 2 POP_JUMP_IF_TRUE 26
151 6 LOAD_GLOBAL 0 (AssertionError) 151 4 LOAD_GLOBAL 0 (AssertionError)
152 9 LOAD_CONST 2 (<code object <listcomp> at 0x..., fi le "%s", line %d>) 152 6 LOAD_CONST 2 (<code object <listcomp> at 0x..., fi le "%s", line %d>)
153 12 LOAD_CONST 3 ('bug1333982.<locals>.<listcomp>') 153 8 LOAD_CONST 3 ('bug1333982.<locals>.<listcomp>')
154 15 MAKE_FUNCTION 0 154 10 MAKE_FUNCTION 0
155 18 LOAD_FAST 0 (x) 155 12 LOAD_FAST 0 (x)
156 21 GET_ITER 156 14 GET_ITER
157 16 CALL_FUNCTION 1 (1 positional, 0 keyword pair)
158
159 %3d 18 LOAD_CONST 4 (1)
160 20 BINARY_ADD
157 22 CALL_FUNCTION 1 (1 positional, 0 keyword pair) 161 22 CALL_FUNCTION 1 (1 positional, 0 keyword pair)
158 162 24 RAISE_VARARGS 1
159 %3d 25 LOAD_CONST 4 (1) 163
160 28 BINARY_ADD 164 %3d >> 26 LOAD_CONST 0 (None)
161 29 CALL_FUNCTION 1 (1 positional, 0 keyword pair) 165 28 RETURN_VALUE
162 32 RAISE_VARARGS 1
163
164 %3d >> 35 LOAD_CONST 0 (None)
165 38 RETURN_VALUE
166 """ % (bug1333982.__code__.co_firstlineno + 1, 166 """ % (bug1333982.__code__.co_firstlineno + 1,
167 __file__, 167 __file__,
168 bug1333982.__code__.co_firstlineno + 1, 168 bug1333982.__code__.co_firstlineno + 1,
169 bug1333982.__code__.co_firstlineno + 2, 169 bug1333982.__code__.co_firstlineno + 2,
170 bug1333982.__code__.co_firstlineno + 3) 170 bug1333982.__code__.co_firstlineno + 3)
171 171
172 _BIG_LINENO_FORMAT = """\ 172 _BIG_LINENO_FORMAT = """\
173 %3d 0 LOAD_GLOBAL 0 (spam) 173 %3d 0 LOAD_GLOBAL 0 (spam)
174 3 POP_TOP 174 2 POP_TOP
175 4 LOAD_CONST 0 (None) 175 4 LOAD_CONST 0 (None)
176 7 RETURN_VALUE 176 6 RETURN_VALUE
177 """ 177 """
178 178
179 dis_module_expected_results = """\ 179 dis_module_expected_results = """\
180 Disassembly of f: 180 Disassembly of f:
181 4 0 LOAD_CONST 0 (None) 181 4 0 LOAD_CONST 0 (None)
182 3 RETURN_VALUE 182 2 RETURN_VALUE
183 183
184 Disassembly of g: 184 Disassembly of g:
185 5 0 LOAD_CONST 0 (None) 185 5 0 LOAD_CONST 0 (None)
186 3 RETURN_VALUE 186 2 RETURN_VALUE
187 187
188 """ 188 """
189 189
190 expr_str = "x + 1" 190 expr_str = "x + 1"
191 191
192 dis_expr_str = """\ 192 dis_expr_str = """\
193 1 0 LOAD_NAME 0 (x) 193 1 0 LOAD_NAME 0 (x)
194 3 LOAD_CONST 0 (1) 194 2 LOAD_CONST 0 (1)
195 6 BINARY_ADD 195 4 BINARY_ADD
196 7 RETURN_VALUE 196 6 RETURN_VALUE
197 """ 197 """
198 198
199 simple_stmt_str = "x = x + 1" 199 simple_stmt_str = "x = x + 1"
200 200
201 dis_simple_stmt_str = """\ 201 dis_simple_stmt_str = """\
202 1 0 LOAD_NAME 0 (x) 202 1 0 LOAD_NAME 0 (x)
203 3 LOAD_CONST 0 (1) 203 2 LOAD_CONST 0 (1)
204 6 BINARY_ADD 204 4 BINARY_ADD
205 7 STORE_NAME 0 (x) 205 6 STORE_NAME 0 (x)
206 10 LOAD_CONST 1 (None) 206 8 LOAD_CONST 1 (None)
207 13 RETURN_VALUE 207 10 RETURN_VALUE
208 """ 208 """
209 209
210 compound_stmt_str = """\ 210 compound_stmt_str = """\
211 x = 0 211 x = 0
212 while 1: 212 while 1:
213 x += 1""" 213 x += 1"""
214 # Trailing newline has been deliberately omitted 214 # Trailing newline has been deliberately omitted
215 215
216 dis_compound_stmt_str = """\ 216 dis_compound_stmt_str = """\
217 1 0 LOAD_CONST 0 (0) 217 1 0 LOAD_CONST 0 (0)
218 3 STORE_NAME 0 (x) 218 2 STORE_NAME 0 (x)
219 219
220 2 6 SETUP_LOOP 14 (to 23) 220 2 4 SETUP_LOOP 12 (to 18)
221 221
222 3 >> 9 LOAD_NAME 0 (x) 222 3 >> 6 LOAD_NAME 0 (x)
223 12 LOAD_CONST 1 (1) 223 8 LOAD_CONST 1 (1)
224 15 INPLACE_ADD 224 10 INPLACE_ADD
225 16 STORE_NAME 0 (x) 225 12 STORE_NAME 0 (x)
226 19 JUMP_ABSOLUTE 9 226 14 JUMP_ABSOLUTE 6
227 22 POP_BLOCK 227 16 POP_BLOCK
228 >> 23 LOAD_CONST 2 (None) 228 >> 18 LOAD_CONST 2 (None)
229 26 RETURN_VALUE 229 20 RETURN_VALUE
230 """ 230 """
231 231
232 dis_traceback = """\ 232 dis_traceback = """\
233 %3d 0 SETUP_EXCEPT 12 (to 15) 233 %3d 0 SETUP_EXCEPT 12 (to 14)
234 234
235 %3d 3 LOAD_CONST 1 (1) 235 %3d 2 LOAD_CONST 1 (1)
236 6 LOAD_CONST 2 (0) 236 4 LOAD_CONST 2 (0)
237 --> 9 BINARY_TRUE_DIVIDE 237 --> 6 BINARY_TRUE_DIVIDE
238 10 POP_TOP 238 8 POP_TOP
239 11 POP_BLOCK 239 10 POP_BLOCK
240 12 JUMP_FORWARD 46 (to 61) 240 12 JUMP_FORWARD 40 (to 54)
241 241
242 %3d >> 15 DUP_TOP 242 %3d >> 14 DUP_TOP
243 16 LOAD_GLOBAL 0 (Exception) 243 16 LOAD_GLOBAL 0 (Exception)
244 19 COMPARE_OP 10 (exception match) 244 18 COMPARE_OP 10 (exception match)
245 22 POP_JUMP_IF_FALSE 60 245 20 POP_JUMP_IF_FALSE 52
246 25 POP_TOP 246 22 POP_TOP
247 26 STORE_FAST 0 (e) 247 24 STORE_FAST 0 (e)
248 29 POP_TOP 248 26 POP_TOP
249 30 SETUP_FINALLY 14 (to 47) 249 28 SETUP_FINALLY 12 (to 42)
250 250
251 %3d 33 LOAD_FAST 0 (e) 251 %3d 30 LOAD_FAST 0 (e)
252 36 LOAD_ATTR 1 (__traceback__) 252 32 LOAD_ATTR 1 (__traceback__)
253 39 STORE_FAST 1 (tb) 253 34 STORE_FAST 1 (tb)
254 42 POP_BLOCK 254 36 POP_BLOCK
255 43 POP_EXCEPT 255 38 POP_EXCEPT
256 44 LOAD_CONST 0 (None) 256 40 LOAD_CONST 0 (None)
257 >> 47 LOAD_CONST 0 (None) 257 >> 42 LOAD_CONST 0 (None)
258 50 STORE_FAST 0 (e) 258 44 STORE_FAST 0 (e)
259 53 DELETE_FAST 0 (e) 259 46 DELETE_FAST 0 (e)
260 56 END_FINALLY 260 48 END_FINALLY
261 57 JUMP_FORWARD 1 (to 61) 261 50 JUMP_FORWARD 2 (to 54)
262 >> 60 END_FINALLY 262 >> 52 END_FINALLY
263 263
264 %3d >> 61 LOAD_FAST 1 (tb) 264 %3d >> 54 LOAD_FAST 1 (tb)
265 64 RETURN_VALUE 265 56 RETURN_VALUE
266 """ % (TRACEBACK_CODE.co_firstlineno + 1, 266 """ % (TRACEBACK_CODE.co_firstlineno + 1,
267 TRACEBACK_CODE.co_firstlineno + 2, 267 TRACEBACK_CODE.co_firstlineno + 2,
268 TRACEBACK_CODE.co_firstlineno + 3, 268 TRACEBACK_CODE.co_firstlineno + 3,
269 TRACEBACK_CODE.co_firstlineno + 4, 269 TRACEBACK_CODE.co_firstlineno + 4,
270 TRACEBACK_CODE.co_firstlineno + 5) 270 TRACEBACK_CODE.co_firstlineno + 5)
271 271
272 def _g(x): 272 def _g(x):
273 yield x 273 yield x
274 274
275 class DisTests(unittest.TestCase): 275 class DisTests(unittest.TestCase):
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 #print('expected_opinfo_inner = [\n ', 643 #print('expected_opinfo_inner = [\n ',
644 #',\n '.join(map(str, _instructions)), ',\n]', sep='') 644 #',\n '.join(map(str, _instructions)), ',\n]', sep='')
645 #_instructions = dis.get_instructions(jumpy, first_line=expected_jumpy_line) 645 #_instructions = dis.get_instructions(jumpy, first_line=expected_jumpy_line)
646 #print('expected_opinfo_jumpy = [\n ', 646 #print('expected_opinfo_jumpy = [\n ',
647 #',\n '.join(map(str, _instructions)), ',\n]', sep='') 647 #',\n '.join(map(str, _instructions)), ',\n]', sep='')
648 648
649 649
650 Instruction = dis.Instruction 650 Instruction = dis.Instruction
651 expected_opinfo_outer = [ 651 expected_opinfo_outer = [
652 Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval=(3, 4), argrepr='(3 , 4)', offset=0, starts_line=2, is_jump_target=False), 652 Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval=(3, 4), argrepr='(3 , 4)', offset=0, starts_line=2, is_jump_target=False),
653 Instruction(opname='LOAD_CLOSURE', opcode=135, arg=0, argval='a', argrepr='a', offset=3, starts_line=None, is_jump_target=False), 653 Instruction(opname='LOAD_CLOSURE', opcode=135, arg=0, argval='a', argrepr='a', offset=2, starts_line=None, is_jump_target=False),
654 Instruction(opname='LOAD_CLOSURE', opcode=135, arg=1, argval='b', argrepr='b', offset=6, starts_line=None, is_jump_target=False), 654 Instruction(opname='LOAD_CLOSURE', opcode=135, arg=1, argval='b', argrepr='b', offset=4, starts_line=None, is_jump_target=False),
655 Instruction(opname='BUILD_TUPLE', opcode=102, arg=2, argval=2, argrepr='', off set=9, starts_line=None, is_jump_target=False), 655 Instruction(opname='BUILD_TUPLE', opcode=102, arg=2, argval=2, argrepr='', off set=6, starts_line=None, is_jump_target=False),
656 Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=code_object_f, argr epr=repr(code_object_f), offset=12, starts_line=None, is_jump_target=False), 656 Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=code_object_f, argr epr=repr(code_object_f), offset=8, starts_line=None, is_jump_target=False),
657 Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='outer.<locals>.f', argrepr="'outer.<locals>.f'", offset=15, starts_line=None, is_jump_target=False ), 657 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 ),
658 Instruction(opname='MAKE_FUNCTION', opcode=132, arg=9, argval=9, argrepr='', o ffset=18, starts_line=None, is_jump_target=False), 658 Instruction(opname='MAKE_FUNCTION', opcode=132, arg=9, argval=9, argrepr='', o ffset=12, starts_line=None, is_jump_target=False),
659 Instruction(opname='STORE_FAST', opcode=125, arg=2, argval='f', argrepr='f', o ffset=21, starts_line=None, is_jump_target=False), 659 Instruction(opname='STORE_FAST', opcode=125, arg=2, argval='f', argrepr='f', o ffset=14, starts_line=None, is_jump_target=False),
660 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=0, argval='print', argrepr=' print', offset=24, starts_line=7, is_jump_target=False), 660 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=0, argval='print', argrepr=' print', offset=16, starts_line=7, is_jump_target=False),
661 Instruction(opname='LOAD_DEREF', opcode=136, arg=0, argval='a', argrepr='a', o ffset=27, starts_line=None, is_jump_target=False), 661 Instruction(opname='LOAD_DEREF', opcode=136, arg=0, argval='a', argrepr='a', o ffset=18, starts_line=None, is_jump_target=False),
662 Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='b', argrepr='b', o ffset=30, starts_line=None, is_jump_target=False), 662 Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='b', argrepr='b', o ffset=20, starts_line=None, is_jump_target=False),
663 Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval='', argrepr="''", o ffset=33, starts_line=None, is_jump_target=False), 663 Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval='', argrepr="''", o ffset=22, starts_line=None, is_jump_target=False),
664 Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval=1, argrepr='1', off set=36, starts_line=None, is_jump_target=False), 664 Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval=1, argrepr='1', off set=24, starts_line=None, is_jump_target=False),
665 Instruction(opname='BUILD_LIST', opcode=103, arg=0, argval=0, argrepr='', offs et=39, starts_line=None, is_jump_target=False), 665 Instruction(opname='BUILD_LIST', opcode=103, arg=0, argval=0, argrepr='', offs et=26, starts_line=None, is_jump_target=False),
666 Instruction(opname='BUILD_MAP', opcode=105, arg=0, argval=0, argrepr='', offse t=42, starts_line=None, is_jump_target=False), 666 Instruction(opname='BUILD_MAP', opcode=105, arg=0, argval=0, argrepr='', offse t=28, starts_line=None, is_jump_target=False),
667 Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval='Hello world!', arg repr="'Hello world!'", offset=45, starts_line=None, is_jump_target=False), 667 Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval='Hello world!', arg repr="'Hello world!'", offset=30, starts_line=None, is_jump_target=False),
668 Instruction(opname='CALL_FUNCTION', opcode=131, arg=7, argval=7, argrepr='7 po sitional, 0 keyword pair', offset=48, starts_line=None, is_jump_target=False), 668 Instruction(opname='CALL_FUNCTION', opcode=131, arg=7, argval=7, argrepr='7 po sitional, 0 keyword pair', offset=32, starts_line=None, is_jump_target=False),
669 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=51, starts_line=None, is_jump_target=False), 669 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=34, starts_line=None, is_jump_target=False),
670 Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='f', argrepr='f', of fset=52, starts_line=8, is_jump_target=False), 670 Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='f', argrepr='f', of fset=36, starts_line=8, is_jump_target=False),
671 Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr=' ', offset=55, starts_line=None, is_jump_target=False), 671 Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr=' ', offset=38, starts_line=None, is_jump_target=False),
672 ] 672 ]
673 673
674 expected_opinfo_f = [ 674 expected_opinfo_f = [
675 Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=(5, 6), argrepr='(5 , 6)', offset=0, starts_line=3, is_jump_target=False), 675 Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=(5, 6), argrepr='(5 , 6)', offset=0, starts_line=3, is_jump_target=False),
676 Instruction(opname='LOAD_CLOSURE', opcode=135, arg=2, argval='a', argrepr='a', offset=3, starts_line=None, is_jump_target=False), 676 Instruction(opname='LOAD_CLOSURE', opcode=135, arg=2, argval='a', argrepr='a', offset=2, starts_line=None, is_jump_target=False),
677 Instruction(opname='LOAD_CLOSURE', opcode=135, arg=3, argval='b', argrepr='b', offset=6, starts_line=None, is_jump_target=False), 677 Instruction(opname='LOAD_CLOSURE', opcode=135, arg=3, argval='b', argrepr='b', offset=4, starts_line=None, is_jump_target=False),
678 Instruction(opname='LOAD_CLOSURE', opcode=135, arg=0, argval='c', argrepr='c', offset=9, starts_line=None, is_jump_target=False), 678 Instruction(opname='LOAD_CLOSURE', opcode=135, arg=0, argval='c', argrepr='c', offset=6, starts_line=None, is_jump_target=False),
679 Instruction(opname='LOAD_CLOSURE', opcode=135, arg=1, argval='d', argrepr='d', offset=12, starts_line=None, is_jump_target=False), 679 Instruction(opname='LOAD_CLOSURE', opcode=135, arg=1, argval='d', argrepr='d', offset=8, starts_line=None, is_jump_target=False),
680 Instruction(opname='BUILD_TUPLE', opcode=102, arg=4, argval=4, argrepr='', off set=15, starts_line=None, is_jump_target=False), 680 Instruction(opname='BUILD_TUPLE', opcode=102, arg=4, argval=4, argrepr='', off set=10, starts_line=None, is_jump_target=False),
681 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=Fal se), 681 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=Fal se),
682 Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='outer.<locals>.f.< locals>.inner', argrepr="'outer.<locals>.f.<locals>.inner'", offset=21, starts_l ine=None, is_jump_target=False), 682 Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='outer.<locals>.f.< locals>.inner', argrepr="'outer.<locals>.f.<locals>.inner'", offset=14, starts_l ine=None, is_jump_target=False),
683 Instruction(opname='MAKE_FUNCTION', opcode=132, arg=9, argval=9, argrepr='', o ffset=24, starts_line=None, is_jump_target=False), 683 Instruction(opname='MAKE_FUNCTION', opcode=132, arg=9, argval=9, argrepr='', o ffset=16, starts_line=None, is_jump_target=False),
684 Instruction(opname='STORE_FAST', opcode=125, arg=2, argval='inner', argrepr='i nner', offset=27, starts_line=None, is_jump_target=False), 684 Instruction(opname='STORE_FAST', opcode=125, arg=2, argval='inner', argrepr='i nner', offset=18, starts_line=None, is_jump_target=False),
685 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=0, argval='print', argrepr=' print', offset=30, starts_line=5, is_jump_target=False), 685 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=0, argval='print', argrepr=' print', offset=20, starts_line=5, is_jump_target=False),
686 Instruction(opname='LOAD_DEREF', opcode=136, arg=2, argval='a', argrepr='a', o ffset=33, starts_line=None, is_jump_target=False), 686 Instruction(opname='LOAD_DEREF', opcode=136, arg=2, argval='a', argrepr='a', o ffset=22, starts_line=None, is_jump_target=False),
687 Instruction(opname='LOAD_DEREF', opcode=136, arg=3, argval='b', argrepr='b', o ffset=36, starts_line=None, is_jump_target=False), 687 Instruction(opname='LOAD_DEREF', opcode=136, arg=3, argval='b', argrepr='b', o ffset=24, starts_line=None, is_jump_target=False),
688 Instruction(opname='LOAD_DEREF', opcode=136, arg=0, argval='c', argrepr='c', o ffset=39, starts_line=None, is_jump_target=False), 688 Instruction(opname='LOAD_DEREF', opcode=136, arg=0, argval='c', argrepr='c', o ffset=26, starts_line=None, is_jump_target=False),
689 Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='d', argrepr='d', o ffset=42, starts_line=None, is_jump_target=False), 689 Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='d', argrepr='d', o ffset=28, starts_line=None, is_jump_target=False),
690 Instruction(opname='CALL_FUNCTION', opcode=131, arg=4, argval=4, argrepr='4 po sitional, 0 keyword pair', offset=45, starts_line=None, is_jump_target=False), 690 Instruction(opname='CALL_FUNCTION', opcode=131, arg=4, argval=4, argrepr='4 po sitional, 0 keyword pair', offset=30, starts_line=None, is_jump_target=False),
691 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=48, starts_line=None, is_jump_target=False), 691 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=32, starts_line=None, is_jump_target=False),
692 Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='inner', argrepr='in ner', offset=49, starts_line=6, is_jump_target=False), 692 Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='inner', argrepr='in ner', offset=34, starts_line=6, is_jump_target=False),
693 Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr=' ', offset=52, starts_line=None, is_jump_target=False), 693 Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr=' ', offset=36, starts_line=None, is_jump_target=False),
694 ] 694 ]
695 695
696 expected_opinfo_inner = [ 696 expected_opinfo_inner = [
697 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=0, argval='print', argrepr=' print', offset=0, starts_line=4, is_jump_target=False), 697 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=0, argval='print', argrepr=' print', offset=0, starts_line=4, is_jump_target=False),
698 Instruction(opname='LOAD_DEREF', opcode=136, arg=0, argval='a', argrepr='a', o ffset=3, starts_line=None, is_jump_target=False), 698 Instruction(opname='LOAD_DEREF', opcode=136, arg=0, argval='a', argrepr='a', o ffset=2, starts_line=None, is_jump_target=False),
699 Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='b', argrepr='b', o ffset=6, starts_line=None, is_jump_target=False), 699 Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='b', argrepr='b', o ffset=4, starts_line=None, is_jump_target=False),
700 Instruction(opname='LOAD_DEREF', opcode=136, arg=2, argval='c', argrepr='c', o ffset=9, starts_line=None, is_jump_target=False), 700 Instruction(opname='LOAD_DEREF', opcode=136, arg=2, argval='c', argrepr='c', o ffset=6, starts_line=None, is_jump_target=False),
701 Instruction(opname='LOAD_DEREF', opcode=136, arg=3, argval='d', argrepr='d', o ffset=12, starts_line=None, is_jump_target=False), 701 Instruction(opname='LOAD_DEREF', opcode=136, arg=3, argval='d', argrepr='d', o ffset=8, starts_line=None, is_jump_target=False),
702 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='e', argrepr='e', of fset=15, starts_line=None, is_jump_target=False), 702 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='e', argrepr='e', of fset=10, starts_line=None, is_jump_target=False),
703 Instruction(opname='LOAD_FAST', opcode=124, arg=1, argval='f', argrepr='f', of fset=18, starts_line=None, is_jump_target=False), 703 Instruction(opname='LOAD_FAST', opcode=124, arg=1, argval='f', argrepr='f', of fset=12, starts_line=None, is_jump_target=False),
704 Instruction(opname='CALL_FUNCTION', opcode=131, arg=6, argval=6, argrepr='6 po sitional, 0 keyword pair', offset=21, starts_line=None, is_jump_target=False), 704 Instruction(opname='CALL_FUNCTION', opcode=131, arg=6, argval=6, argrepr='6 po sitional, 0 keyword pair', offset=14, starts_line=None, is_jump_target=False),
705 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=24, starts_line=None, is_jump_target=False), 705 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=16, starts_line=None, is_jump_target=False),
706 Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None ', offset=25, starts_line=None, is_jump_target=False), 706 Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None ', offset=18, starts_line=None, is_jump_target=False),
707 Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr=' ', offset=28, starts_line=None, is_jump_target=False), 707 Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr=' ', offset=20, starts_line=None, is_jump_target=False),
708 ] 708 ]
709 709
710 expected_opinfo_jumpy = [ 710 expected_opinfo_jumpy = [
711 Instruction(opname='SETUP_LOOP', opcode=120, arg=68, argval=71, argrepr='to 71 ', offset=0, starts_line=3, is_jump_target=False), 711 Instruction(opname='SETUP_LOOP', opcode=120, arg=52, argval=54, argrepr='to 54 ', offset=0, starts_line=3, is_jump_target=False),
712 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=0, argval='range', argrepr=' range', offset=3, starts_line=None, is_jump_target=False), 712 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=0, argval='range', argrepr=' range', offset=2, starts_line=None, is_jump_target=False),
713 Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=10, argrepr='10', o ffset=6, starts_line=None, is_jump_target=False), 713 Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=10, argrepr='10', o ffset=4, starts_line=None, is_jump_target=False),
714 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=9, starts_line=None, is_jump_target=False), 714 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=6, starts_line=None, is_jump_target=False),
715 Instruction(opname='GET_ITER', opcode=68, arg=None, argval=None, argrepr='', o ffset=12, starts_line=None, is_jump_target=False), 715 Instruction(opname='GET_ITER', opcode=68, arg=None, argval=None, argrepr='', o ffset=8, starts_line=None, is_jump_target=False),
716 Instruction(opname='FOR_ITER', opcode=93, arg=44, argval=60, argrepr='to 60', offset=13, starts_line=None, is_jump_target=True), 716 Instruction(opname='FOR_ITER', opcode=93, arg=32, argval=44, argrepr='to 44', offset=10, starts_line=None, is_jump_target=True),
717 Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', o ffset=16, starts_line=None, is_jump_target=False), 717 Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', o ffset=12, starts_line=None, is_jump_target=False),
718 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr=' print', offset=19, starts_line=4, is_jump_target=False), 718 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr=' print', offset=14, starts_line=4, is_jump_target=False),
719 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=22, starts_line=None, is_jump_target=False), 719 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=16, starts_line=None, is_jump_target=False),
720 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=25, starts_line=None, is_jump_target=False), 720 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=18, starts_line=None, is_jump_target=False),
721 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=28, starts_line=None, is_jump_target=False), 721 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=20, starts_line=None, is_jump_target=False),
722 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=29, starts_line=5, is_jump_target=False), 722 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=22, starts_line=5, is_jump_target=False),
723 Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', off set=32, starts_line=None, is_jump_target=False), 723 Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', off set=24, starts_line=None, is_jump_target=False),
724 Instruction(opname='COMPARE_OP', opcode=107, arg=0, argval='<', argrepr='<', o ffset=35, starts_line=None, is_jump_target=False), 724 Instruction(opname='COMPARE_OP', opcode=107, arg=0, argval='<', argrepr='<', o ffset=26, starts_line=None, is_jump_target=False),
725 Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=44, argval=44, argrepr ='', offset=38, starts_line=None, is_jump_target=False), 725 Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=32, argval=32, argrepr ='', offset=28, starts_line=None, is_jump_target=False),
726 Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=13, argval=13, argrepr='', offset=41, starts_line=6, is_jump_target=False), 726 Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=10, argval=10, argrepr='', offset=30, starts_line=6, is_jump_target=False),
727 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=44, starts_line=7, is_jump_target=True), 727 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=32, starts_line=7, is_jump_target=True),
728 Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', off set=47, starts_line=None, is_jump_target=False), 728 Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', off set=34, starts_line=None, is_jump_target=False),
729 Instruction(opname='COMPARE_OP', opcode=107, arg=4, argval='>', argrepr='>', o ffset=50, starts_line=None, is_jump_target=False), 729 Instruction(opname='COMPARE_OP', opcode=107, arg=4, argval='>', argrepr='>', o ffset=36, starts_line=None, is_jump_target=False),
730 Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=13, argval=13, argrepr ='', offset=53, starts_line=None, is_jump_target=False), 730 Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=10, argval=10, argrepr ='', offset=38, starts_line=None, is_jump_target=False),
731 Instruction(opname='BREAK_LOOP', opcode=80, arg=None, argval=None, argrepr='', offset=56, starts_line=8, is_jump_target=False), 731 Instruction(opname='BREAK_LOOP', opcode=80, arg=None, argval=None, argrepr='', offset=40, starts_line=8, is_jump_target=False),
732 Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=13, argval=13, argrepr='', offset=57, starts_line=None, is_jump_target=False), 732 Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=10, argval=10, argrepr='', offset=42, starts_line=None, is_jump_target=False),
733 Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=60, starts_line=None, is_jump_target=True), 733 Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=44, starts_line=None, is_jump_target=True),
734 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr=' print', offset=61, starts_line=10, is_jump_target=False), 734 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr=' print', offset=46, starts_line=10, is_jump_target=False),
735 Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='I can haz else cla use?', argrepr="'I can haz else clause?'", offset=64, starts_line=None, is_jump_ target=False), 735 Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='I can haz else cla use?', argrepr="'I can haz else clause?'", offset=48, starts_line=None, is_jump_ target=False),
736 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=67, starts_line=None, is_jump_target=False), 736 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=50, starts_line=None, is_jump_target=False),
737 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=70, starts_line=None, is_jump_target=False), 737 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=52, starts_line=None, is_jump_target=False),
738 Instruction(opname='SETUP_LOOP', opcode=120, arg=68, argval=142, argrepr='to 1 42', offset=71, starts_line=11, is_jump_target=True), 738 Instruction(opname='SETUP_LOOP', opcode=120, arg=52, argval=108, argrepr='to 1 08', offset=54, starts_line=11, is_jump_target=True),
739 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=74, starts_line=None, is_jump_target=True), 739 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=56, starts_line=None, is_jump_target=True),
740 Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=131, argval=131, argre pr='', offset=77, starts_line=None, is_jump_target=False), 740 Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=98, argval=98, argrepr ='', offset=58, starts_line=None, is_jump_target=False),
741 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr=' print', offset=80, starts_line=12, is_jump_target=False), 741 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr=' print', offset=60, starts_line=12, is_jump_target=False),
742 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=83, starts_line=None, is_jump_target=False), 742 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=62, starts_line=None, is_jump_target=False),
743 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=86, starts_line=None, is_jump_target=False), 743 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=64, starts_line=None, is_jump_target=False),
744 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=89, starts_line=None, is_jump_target=False), 744 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=66, starts_line=None, is_jump_target=False),
745 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=90, starts_line=13, is_jump_target=False), 745 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=68, starts_line=13, is_jump_target=False),
746 Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', off set=93, starts_line=None, is_jump_target=False), 746 Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', off set=70, starts_line=None, is_jump_target=False),
747 Instruction(opname='INPLACE_SUBTRACT', opcode=56, arg=None, argval=None, argre pr='', offset=96, starts_line=None, is_jump_target=False), 747 Instruction(opname='INPLACE_SUBTRACT', opcode=56, arg=None, argval=None, argre pr='', offset=72, starts_line=None, is_jump_target=False),
748 Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', o ffset=97, starts_line=None, is_jump_target=False), 748 Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', o ffset=74, starts_line=None, is_jump_target=False),
749 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=100, starts_line=14, is_jump_target=False), 749 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=76, starts_line=14, is_jump_target=False),
750 Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', off set=103, starts_line=None, is_jump_target=False), 750 Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', off set=78, starts_line=None, is_jump_target=False),
751 Instruction(opname='COMPARE_OP', opcode=107, arg=4, argval='>', argrepr='>', o ffset=106, starts_line=None, is_jump_target=False), 751 Instruction(opname='COMPARE_OP', opcode=107, arg=4, argval='>', argrepr='>', o ffset=80, starts_line=None, is_jump_target=False),
752 Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=115, argval=115, argre pr='', offset=109, starts_line=None, is_jump_target=False), 752 Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=86, argval=86, argrepr ='', offset=82, starts_line=None, is_jump_target=False),
753 Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=74, argval=74, argrepr='', offset=112, starts_line=15, is_jump_target=False), 753 Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=56, argval=56, argrepr='', offset=84, starts_line=15, is_jump_target=False),
754 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=115, starts_line=16, is_jump_target=True), 754 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=86, starts_line=16, is_jump_target=True),
755 Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', off set=118, starts_line=None, is_jump_target=False), 755 Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', off set=88, starts_line=None, is_jump_target=False),
756 Instruction(opname='COMPARE_OP', opcode=107, arg=0, argval='<', argrepr='<', o ffset=121, starts_line=None, is_jump_target=False), 756 Instruction(opname='COMPARE_OP', opcode=107, arg=0, argval='<', argrepr='<', o ffset=90, starts_line=None, is_jump_target=False),
757 Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=74, argval=74, argrepr ='', offset=124, starts_line=None, is_jump_target=False), 757 Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=56, argval=56, argrepr ='', offset=92, starts_line=None, is_jump_target=False),
758 Instruction(opname='BREAK_LOOP', opcode=80, arg=None, argval=None, argrepr='', offset=127, starts_line=17, is_jump_target=False), 758 Instruction(opname='BREAK_LOOP', opcode=80, arg=None, argval=None, argrepr='', offset=94, starts_line=17, is_jump_target=False),
759 Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=74, argval=74, argrepr='', offset=128, starts_line=None, is_jump_target=False), 759 Instruction(opname='JUMP_ABSOLUTE', opcode=113, arg=56, argval=56, argrepr='', offset=96, starts_line=None, is_jump_target=False),
760 Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=131, starts_line=None, is_jump_target=True), 760 Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=98, starts_line=None, is_jump_target=True),
761 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr=' print', offset=132, starts_line=19, is_jump_target=False), 761 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr=' print', offset=100, starts_line=19, is_jump_target=False),
762 Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz in to this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset= 135, starts_line=None, is_jump_target=False), 762 Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz in to this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset= 102, starts_line=None, is_jump_target=False),
763 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=138, starts_line=None, is_jump_target=False), 763 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=104, starts_line=None, is_jump_target=False),
764 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=141, starts_line=None, is_jump_target=False), 764 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=106, starts_line=None, is_jump_target=False),
765 Instruction(opname='SETUP_FINALLY', opcode=122, arg=73, argval=218, argrepr='t o 218', offset=142, starts_line=20, is_jump_target=True), 765 Instruction(opname='SETUP_FINALLY', opcode=122, arg=70, argval=180, argrepr='t o 180', offset=108, starts_line=20, is_jump_target=True),
766 Instruction(opname='SETUP_EXCEPT', opcode=121, arg=12, argval=160, argrepr='to 160', offset=145, starts_line=None, is_jump_target=False), 766 Instruction(opname='SETUP_EXCEPT', opcode=121, arg=12, argval=124, argrepr='to 124', offset=110, starts_line=None, is_jump_target=False),
767 Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', off set=148, starts_line=21, is_jump_target=False), 767 Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', off set=112, starts_line=21, is_jump_target=False),
768 Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', off set=151, starts_line=None, is_jump_target=False), 768 Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', off set=114, starts_line=None, is_jump_target=False),
769 Instruction(opname='BINARY_TRUE_DIVIDE', opcode=27, arg=None, argval=None, arg repr='', offset=154, starts_line=None, is_jump_target=False), 769 Instruction(opname='BINARY_TRUE_DIVIDE', opcode=27, arg=None, argval=None, arg repr='', offset=116, starts_line=None, is_jump_target=False),
770 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=155, starts_line=None, is_jump_target=False), 770 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=118, starts_line=None, is_jump_target=False),
771 Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=156, starts_line=None, is_jump_target=False), 771 Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=120, starts_line=None, is_jump_target=False),
772 Instruction(opname='JUMP_FORWARD', opcode=110, arg=28, argval=188, argrepr='to 188', offset=157, starts_line=None, is_jump_target=False), 772 Instruction(opname='JUMP_FORWARD', opcode=110, arg=28, argval=152, argrepr='to 152', offset=122, starts_line=None, is_jump_target=False),
773 Instruction(opname='DUP_TOP', opcode=4, arg=None, argval=None, argrepr='', off set=160, starts_line=22, is_jump_target=True), 773 Instruction(opname='DUP_TOP', opcode=4, arg=None, argval=None, argrepr='', off set=124, starts_line=22, is_jump_target=True),
774 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=2, argval='ZeroDivisionError ', argrepr='ZeroDivisionError', offset=161, starts_line=None, is_jump_target=Fal se), 774 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=2, argval='ZeroDivisionError ', argrepr='ZeroDivisionError', offset=126, starts_line=None, is_jump_target=Fal se),
775 Instruction(opname='COMPARE_OP', opcode=107, arg=10, argval='exception match', argrepr='exception match', offset=164, starts_line=None, is_jump_target=False), 775 Instruction(opname='COMPARE_OP', opcode=107, arg=10, argval='exception match', argrepr='exception match', offset=128, starts_line=None, is_jump_target=False),
776 Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=187, argval=187, argre pr='', offset=167, starts_line=None, is_jump_target=False), 776 Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=150, argval=150, argre pr='', offset=130, starts_line=None, is_jump_target=False),
777 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=170, starts_line=None, is_jump_target=False), 777 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=132, starts_line=None, is_jump_target=False),
778 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=171, starts_line=None, is_jump_target=False), 778 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=134, starts_line=None, is_jump_target=False),
779 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=172, starts_line=None, is_jump_target=False), 779 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=136, starts_line=None, is_jump_target=False),
780 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr=' print', offset=173, starts_line=23, is_jump_target=False), 780 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr=' print', offset=138, starts_line=23, is_jump_target=False),
781 Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Here we go, here w e go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset= 176, starts_line=None, is_jump_target=False), 781 Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Here we go, here w e go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset= 140, starts_line=None, is_jump_target=False),
782 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=179, starts_line=None, is_jump_target=False), 782 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=142, starts_line=None, is_jump_target=False),
783 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=182, starts_line=None, is_jump_target=False), 783 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=144, starts_line=None, is_jump_target=False),
784 Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=183, starts_line=None, is_jump_target=False), 784 Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=146, starts_line=None, is_jump_target=False),
785 Instruction(opname='JUMP_FORWARD', opcode=110, arg=27, argval=214, argrepr='to 214', offset=184, starts_line=None, is_jump_target=False), 785 Instruction(opname='JUMP_FORWARD', opcode=110, arg=26, argval=176, argrepr='to 176', offset=148, starts_line=None, is_jump_target=False),
786 Instruction(opname='END_FINALLY', opcode=88, arg=None, argval=None, argrepr='' , offset=187, starts_line=None, is_jump_target=True), 786 Instruction(opname='END_FINALLY', opcode=88, arg=None, argval=None, argrepr='' , offset=150, starts_line=None, is_jump_target=True),
787 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=188, starts_line=25, is_jump_target=True), 787 Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', of fset=152, starts_line=25, is_jump_target=True),
788 Instruction(opname='SETUP_WITH', opcode=143, arg=17, argval=211, argrepr='to 2 11', offset=191, starts_line=None, is_jump_target=False), 788 Instruction(opname='SETUP_WITH', opcode=143, arg=14, argval=170, argrepr='to 1 70', offset=154, starts_line=None, is_jump_target=False),
789 Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='d odgy', offset=194, starts_line=None, is_jump_target=False), 789 Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='d odgy', offset=156, starts_line=None, is_jump_target=False),
790 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr=' print', offset=197, starts_line=26, is_jump_target=False), 790 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr=' print', offset=158, starts_line=26, is_jump_target=False),
791 Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Never reach this', argrepr="'Never reach this'", offset=200, starts_line=None, is_jump_target=Fals e), 791 Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Never reach this', argrepr="'Never reach this'", offset=160, starts_line=None, is_jump_target=Fals e),
792 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=203, starts_line=None, is_jump_target=False), 792 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=162, starts_line=None, is_jump_target=False),
793 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=206, starts_line=None, is_jump_target=False), 793 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=164, starts_line=None, is_jump_target=False),
794 Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=207, starts_line=None, is_jump_target=False), 794 Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=166, starts_line=None, is_jump_target=False),
795 Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None ', offset=208, starts_line=None, is_jump_target=False), 795 Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None ', offset=168, starts_line=None, is_jump_target=False),
796 Instruction(opname='WITH_CLEANUP_START', opcode=81, arg=None, argval=None, arg repr='', offset=211, starts_line=None, is_jump_target=True), 796 Instruction(opname='WITH_CLEANUP_START', opcode=81, arg=None, argval=None, arg repr='', offset=170, starts_line=None, is_jump_target=True),
797 Instruction(opname='WITH_CLEANUP_FINISH', opcode=82, arg=None, argval=None, ar grepr='', offset=212, starts_line=None, is_jump_target=False), 797 Instruction(opname='WITH_CLEANUP_FINISH', opcode=82, arg=None, argval=None, ar grepr='', offset=172, starts_line=None, is_jump_target=False),
798 Instruction(opname='END_FINALLY', opcode=88, arg=None, argval=None, argrepr='' , offset=213, starts_line=None, is_jump_target=False), 798 Instruction(opname='END_FINALLY', opcode=88, arg=None, argval=None, argrepr='' , offset=174, starts_line=None, is_jump_target=False),
799 Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=214, starts_line=None, is_jump_target=True), 799 Instruction(opname='POP_BLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=176, starts_line=None, is_jump_target=True),
800 Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None ', offset=215, starts_line=None, is_jump_target=False), 800 Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None ', offset=178, starts_line=None, is_jump_target=False),
801 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr=' print', offset=218, starts_line=28, is_jump_target=True), 801 Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr=' print', offset=180, starts_line=28, is_jump_target=True),
802 Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're don e", argrepr='"OK, now we\'re done"', offset=221, starts_line=None, is_jump_targe t=False), 802 Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're don e", argrepr='"OK, now we\'re done"', offset=182, starts_line=None, is_jump_targe t=False),
803 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=224, starts_line=None, is_jump_target=False), 803 Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 po sitional, 0 keyword pair', offset=184, starts_line=None, is_jump_target=False),
804 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=227, starts_line=None, is_jump_target=False), 804 Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', off set=186, starts_line=None, is_jump_target=False),
805 Instruction(opname='END_FINALLY', opcode=88, arg=None, argval=None, argrepr='' , offset=228, starts_line=None, is_jump_target=False), 805 Instruction(opname='END_FINALLY', opcode=88, arg=None, argval=None, argrepr='' , offset=188, starts_line=None, is_jump_target=False),
806 Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None ', offset=229, starts_line=None, is_jump_target=False), 806 Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None ', offset=190, starts_line=None, is_jump_target=False),
807 Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr=' ', offset=232, starts_line=None, is_jump_target=False), 807 Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr=' ', offset=192, starts_line=None, is_jump_target=False),
808 ] 808 ]
809 809
810 # One last piece of inspect fodder to check the default line number handling 810 # One last piece of inspect fodder to check the default line number handling
811 def simple(): pass 811 def simple(): pass
812 expected_opinfo_simple = [ 812 expected_opinfo_simple = [
813 Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None ', offset=0, starts_line=simple.__code__.co_firstlineno, is_jump_target=False), 813 Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None ', offset=0, starts_line=simple.__code__.co_firstlineno, is_jump_target=False),
814 Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr=' ', offset=3, starts_line=None, is_jump_target=False) 814 Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr=' ', offset=2, starts_line=None, is_jump_target=False)
815 ] 815 ]
816 816
817 817
818 class InstructionTests(BytecodeTestCase): 818 class InstructionTests(BytecodeTestCase):
819 819
820 def test_default_first_line(self): 820 def test_default_first_line(self):
821 actual = dis.get_instructions(simple) 821 actual = dis.get_instructions(simple)
822 self.assertEqual(list(actual), expected_opinfo_simple) 822 self.assertEqual(list(actual), expected_opinfo_simple)
823 823
824 def test_first_line_set_to_None(self): 824 def test_first_line_set_to_None(self):
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 894
895 self.assertEqual(b.current_offset, tb.tb_lasti) 895 self.assertEqual(b.current_offset, tb.tb_lasti)
896 896
897 def test_from_traceback_dis(self): 897 def test_from_traceback_dis(self):
898 tb = get_tb() 898 tb = get_tb()
899 b = dis.Bytecode.from_traceback(tb) 899 b = dis.Bytecode.from_traceback(tb)
900 self.assertEqual(b.dis(), dis_traceback) 900 self.assertEqual(b.dis(), dis_traceback)
901 901
902 if __name__ == "__main__": 902 if __name__ == "__main__":
903 unittest.main() 903 unittest.main()
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+