diff --git a/test/bytecode_3.5/01_map_unpack.pyc b/test/bytecode_3.5/01_map_unpack.pyc index aa578f6b..02f5c80b 100644 Binary files a/test/bytecode_3.5/01_map_unpack.pyc and b/test/bytecode_3.5/01_map_unpack.pyc differ diff --git a/test/simple_source/bug35/01_map_unpack.py b/test/simple_source/bug35/01_map_unpack.py index 49b32f95..09be6152 100644 --- a/test/simple_source/bug35/01_map_unpack.py +++ b/test/simple_source/bug35/01_map_unpack.py @@ -4,3 +4,4 @@ {'x': 1, **{'y': 2}} # {'c': 1, {'d': 2}, **{'e': 3}} [*[]] +{**{0:0 for a in b}} diff --git a/uncompyle6/parsers/parse35.py b/uncompyle6/parsers/parse35.py index d9271618..e28da1ef 100644 --- a/uncompyle6/parsers/parse35.py +++ b/uncompyle6/parsers/parse35.py @@ -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 diff --git a/uncompyle6/semantics/pysource.py b/uncompyle6/semantics/pysource.py index 4985432d..3ba751cd 100644 --- a/uncompyle6/semantics/pysource.py +++ b/uncompyle6/semantics/pysource.py @@ -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