Skip to content

Commit 7857e50

Browse files
committed
Use list rather than repr. Use blank lines rather than docstring.
1 parent 5e8ec42 commit 7857e50

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

Lib/test/test_code.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
freevars: ()
1818
nlocals: 2
1919
flags: 3
20-
lnotab: b'\\x04\\x01\\n\\x02'
20+
lnotab: [4, 1, 10, 2]
2121
consts: ('None', '<code object g>')
2222
2323
>>> dump(f(4).__code__)
@@ -31,7 +31,7 @@
3131
freevars: ('x',)
3232
nlocals: 1
3333
flags: 19
34-
lnotab: b'\\x04\\x01'
34+
lnotab: [4, 1]
3535
consts: ('None',)
3636
3737
>>> def h(x, y):
@@ -52,7 +52,7 @@
5252
freevars: ()
5353
nlocals: 5
5454
flags: 3
55-
lnotab: b'\\x02\\x01\\n\\x01\\n\\x01\\n\\x01'
55+
lnotab: [2, 1, 10, 1, 10, 1, 10, 1]
5656
consts: ('None',)
5757
5858
>>> def attrs(obj):
@@ -71,7 +71,7 @@
7171
freevars: ()
7272
nlocals: 1
7373
flags: 3
74-
lnotab: b'\\x02\\x01.\\x01.\\x01'
74+
lnotab: [2, 1, 46, 1, 46, 1]
7575
consts: ('None',)
7676
7777
>>> def optimize_away():
@@ -91,7 +91,7 @@
9191
freevars: ()
9292
nlocals: 0
9393
flags: 3
94-
lnotab: b'\\x02\\x02\\x02\\x01\\x02\\x01'
94+
lnotab: [2, 2, 2, 1, 2, 1]
9595
consts: ("'doc string'", 'None')
9696
9797
>>> def keywordonly_args(a,b,*,k1):
@@ -109,7 +109,7 @@
109109
freevars: ()
110110
nlocals: 3
111111
flags: 3
112-
lnotab: b'\\x02\\x01'
112+
lnotab: [2, 1]
113113
consts: ('None',)
114114
115115
>>> def posonly_args(a,b,/,c):
@@ -127,7 +127,7 @@
127127
freevars: ()
128128
nlocals: 3
129129
flags: 3
130-
lnotab: b'\\x02\\x01'
130+
lnotab: [2, 1]
131131
consts: ('None',)
132132
133133
"""
@@ -168,7 +168,7 @@ def dump(co):
168168
"kwonlyargcount", "names", "varnames",
169169
"cellvars", "freevars", "nlocals", "flags"]:
170170
print("%s: %s" % (attr, getattr(co, "co_" + attr)))
171-
print("lnotab:", repr(co.co_lnotab))
171+
print("lnotab:", list(co.co_lnotab))
172172
print("consts:", tuple(consts(co.co_consts)))
173173

174174
# Needed for test_closure_injection below
@@ -440,10 +440,8 @@ def test_large_lnotab(self):
440440
d = {}
441441
lines = (
442442
["def f():"] +
443-
[' """'] +
444-
[' .'] * (1 << 17) +
445-
[' """'] +
446-
[" x = 1"] * (1 << 17)
443+
[""] * (1 << 17) +
444+
[" pass"] * (1 << 17)
447445
)
448446
source = "\n".join(lines)
449447
exec(source, d)

0 commit comments

Comments
 (0)