You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Correct bug in 3.5+ build_list with UNPACK
This commit is contained in:
@@ -3,3 +3,4 @@
|
|||||||
{**{'a': 1, 'b': 2}}
|
{**{'a': 1, 'b': 2}}
|
||||||
{'x': 1, **{'y': 2}}
|
{'x': 1, **{'y': 2}}
|
||||||
# {'c': 1, {'d': 2}, **{'e': 3}}
|
# {'c': 1, {'d': 2}, **{'e': 3}}
|
||||||
|
[*[]]
|
||||||
|
@@ -1536,22 +1536,20 @@ class SourceWalker(GenericASTTraversal, object):
|
|||||||
# will assume that if the text ends in *.
|
# will assume that if the text ends in *.
|
||||||
last_was_star = self.f.getvalue().endswith('*')
|
last_was_star = self.f.getvalue().endswith('*')
|
||||||
|
|
||||||
|
if lastnodetype.startswith('BUILD_LIST'):
|
||||||
|
self.write('['); endchar = ']'
|
||||||
|
elif lastnodetype.startswith('BUILD_TUPLE'):
|
||||||
|
self.write('('); endchar = ')'
|
||||||
|
elif lastnodetype.startswith('BUILD_SET'):
|
||||||
|
self.write('{'); endchar = '}'
|
||||||
|
elif lastnodetype.startswith('ROT_TWO'):
|
||||||
|
self.write('('); endchar = ')'
|
||||||
|
else:
|
||||||
|
raise 'Internal Error: n_build_list expects list or tuple'
|
||||||
have_star = False
|
have_star = False
|
||||||
if lastnodetype.endswith('UNPACK'):
|
if lastnodetype.endswith('UNPACK'):
|
||||||
# FIXME: need to handle range of BUILD_LIST_UNPACK
|
# FIXME: need to handle range of BUILD_LIST_UNPACK
|
||||||
have_star = True
|
have_star = True
|
||||||
endchar = ''
|
|
||||||
else:
|
|
||||||
if lastnodetype.startswith('BUILD_LIST'):
|
|
||||||
self.write('['); endchar = ']'
|
|
||||||
elif lastnodetype.startswith('BUILD_TUPLE'):
|
|
||||||
self.write('('); endchar = ')'
|
|
||||||
elif lastnodetype.startswith('BUILD_SET'):
|
|
||||||
self.write('{'); endchar = '}'
|
|
||||||
elif lastnodetype.startswith('ROT_TWO'):
|
|
||||||
self.write('('); endchar = ')'
|
|
||||||
else:
|
|
||||||
raise 'Internal Error: n_build_list expects list or tuple'
|
|
||||||
|
|
||||||
flat_elems = []
|
flat_elems = []
|
||||||
for elem in node:
|
for elem in node:
|
||||||
|
Reference in New Issue
Block a user