|
17 | 17 | freevars: ()
|
18 | 18 | nlocals: 2
|
19 | 19 | flags: 3
|
20 |
| -lnotab: b'\\x04\\x01\\n\\x02' |
| 20 | +lnotab: [4, 1, 10, 2] |
21 | 21 | consts: ('None', '<code object g>')
|
22 | 22 |
|
23 | 23 | >>> dump(f(4).__code__)
|
|
31 | 31 | freevars: ('x',)
|
32 | 32 | nlocals: 1
|
33 | 33 | flags: 19
|
34 |
| -lnotab: b'\\x04\\x01' |
| 34 | +lnotab: [4, 1] |
35 | 35 | consts: ('None',)
|
36 | 36 |
|
37 | 37 | >>> def h(x, y):
|
|
52 | 52 | freevars: ()
|
53 | 53 | nlocals: 5
|
54 | 54 | flags: 3
|
55 |
| -lnotab: b'\\x02\\x01\\n\\x01\\n\\x01\\n\\x01' |
| 55 | +lnotab: [2, 1, 10, 1, 10, 1, 10, 1] |
56 | 56 | consts: ('None',)
|
57 | 57 |
|
58 | 58 | >>> def attrs(obj):
|
|
71 | 71 | freevars: ()
|
72 | 72 | nlocals: 1
|
73 | 73 | flags: 3
|
74 |
| -lnotab: b'\\x02\\x01.\\x01.\\x01' |
| 74 | +lnotab: [2, 1, 46, 1, 46, 1] |
75 | 75 | consts: ('None',)
|
76 | 76 |
|
77 | 77 | >>> def optimize_away():
|
|
91 | 91 | freevars: ()
|
92 | 92 | nlocals: 0
|
93 | 93 | flags: 3
|
94 |
| -lnotab: b'\\x02\\x02\\x02\\x01\\x02\\x01' |
| 94 | +lnotab: [2, 2, 2, 1, 2, 1] |
95 | 95 | consts: ("'doc string'", 'None')
|
96 | 96 |
|
97 | 97 | >>> def keywordonly_args(a,b,*,k1):
|
|
109 | 109 | freevars: ()
|
110 | 110 | nlocals: 3
|
111 | 111 | flags: 3
|
112 |
| -lnotab: b'\\x02\\x01' |
| 112 | +lnotab: [2, 1] |
113 | 113 | consts: ('None',)
|
114 | 114 |
|
115 | 115 | >>> def posonly_args(a,b,/,c):
|
|
127 | 127 | freevars: ()
|
128 | 128 | nlocals: 3
|
129 | 129 | flags: 3
|
130 |
| -lnotab: b'\\x02\\x01' |
| 130 | +lnotab: [2, 1] |
131 | 131 | consts: ('None',)
|
132 | 132 |
|
133 | 133 | """
|
@@ -168,7 +168,7 @@ def dump(co):
|
168 | 168 | "kwonlyargcount", "names", "varnames",
|
169 | 169 | "cellvars", "freevars", "nlocals", "flags"]:
|
170 | 170 | print("%s: %s" % (attr, getattr(co, "co_" + attr)))
|
171 |
| - print("lnotab:", repr(co.co_lnotab)) |
| 171 | + print("lnotab:", list(co.co_lnotab)) |
172 | 172 | print("consts:", tuple(consts(co.co_consts)))
|
173 | 173 |
|
174 | 174 | # Needed for test_closure_injection below
|
@@ -440,10 +440,8 @@ def test_large_lnotab(self):
|
440 | 440 | d = {}
|
441 | 441 | lines = (
|
442 | 442 | ["def f():"] +
|
443 |
| - [' """'] + |
444 |
| - [' .'] * (1 << 17) + |
445 |
| - [' """'] + |
446 |
| - [" x = 1"] * (1 << 17) |
| 443 | + [""] * (1 << 17) + |
| 444 | + [" pass"] * (1 << 17) |
447 | 445 | )
|
448 | 446 | source = "\n".join(lines)
|
449 | 447 | exec(source, d)
|
|
0 commit comments