You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Handle BUILD_MAP_UNPACK in a build_list
This commit is contained in:
Binary file not shown.
@@ -4,3 +4,4 @@
|
||||
{'x': 1, **{'y': 2}}
|
||||
# {'c': 1, {'d': 2}, **{'e': 3}}
|
||||
[*[]]
|
||||
{**{0:0 for a in b}}
|
||||
|
@@ -33,6 +33,8 @@ class Python35Parser(Python34Parser):
|
||||
stmt ::= await_stmt
|
||||
await_stmt ::= await_expr POP_TOP
|
||||
|
||||
unmap_dict ::= mapexpr BUILD_MAP_UNPACK
|
||||
build_list ::= expr BUILD_MAP_UNPACK
|
||||
|
||||
# Python 3.5+ has WITH_CLEANUP_START/FINISH
|
||||
|
||||
@@ -151,10 +153,6 @@ class Python35Parser(Python34Parser):
|
||||
rule = 'call_function ::= expr unmapexpr ' + call_token.type
|
||||
self.add_unique_rule(rule, opname, token.attr, customize)
|
||||
pass
|
||||
elif opname == 'BUILD_MAP_UNPACK':
|
||||
nargs = token.attr % 256
|
||||
rule = "unmap_dict ::= mapexpr " + opname
|
||||
self.add_unique_rule(rule, opname, token.attr, customize)
|
||||
pass
|
||||
return
|
||||
|
||||
|
@@ -1553,10 +1553,12 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
self.write('('); endchar = ')'
|
||||
elif lastnodetype.startswith('BUILD_SET'):
|
||||
self.write('{'); endchar = '}'
|
||||
elif lastnodetype.startswith('BUILD_MAP_UNPACK'):
|
||||
self.write('{**'); endchar = '}'
|
||||
elif lastnodetype.startswith('ROT_TWO'):
|
||||
self.write('('); endchar = ')'
|
||||
else:
|
||||
raise 'Internal Error: n_build_list expects list or tuple'
|
||||
raise 'Internal Error: n_build_list expects list, tuple, set, or unpack'
|
||||
have_star = False
|
||||
if lastnodetype.endswith('UNPACK'):
|
||||
# FIXME: need to handle range of BUILD_LIST_UNPACK
|
||||
|
Reference in New Issue
Block a user