diff --git a/test/bytecode_3.6/01_call_function.pyc b/test/bytecode_3.6/01_call_function.pyc index f3d0e595..c9642bb1 100644 Binary files a/test/bytecode_3.6/01_call_function.pyc and b/test/bytecode_3.6/01_call_function.pyc differ diff --git a/test/bytecode_3.7/00_assign.pyc b/test/bytecode_3.7/00_assign.pyc new file mode 100644 index 00000000..8f8830c0 Binary files /dev/null and b/test/bytecode_3.7/00_assign.pyc differ diff --git a/test/bytecode_3.7/00_docstring.pyc b/test/bytecode_3.7/00_docstring.pyc new file mode 100644 index 00000000..2c80e86a Binary files /dev/null and b/test/bytecode_3.7/00_docstring.pyc differ diff --git a/test/bytecode_3.7/01_augmented_assign.pyc b/test/bytecode_3.7/01_augmented_assign.pyc new file mode 100644 index 00000000..3efcb3bc Binary files /dev/null and b/test/bytecode_3.7/01_augmented_assign.pyc differ diff --git a/test/bytecode_3.7/01_boolean.pyc b/test/bytecode_3.7/01_boolean.pyc new file mode 100644 index 00000000..9e1ae24f Binary files /dev/null and b/test/bytecode_3.7/01_boolean.pyc differ diff --git a/test/bytecode_3.7/01_extended_arg.pyc b/test/bytecode_3.7/01_extended_arg.pyc new file mode 100644 index 00000000..6337ae35 Binary files /dev/null and b/test/bytecode_3.7/01_extended_arg.pyc differ diff --git a/test/bytecode_3.7/01_map_unpack.pyc b/test/bytecode_3.7/01_map_unpack.pyc new file mode 100644 index 00000000..7e5facaa Binary files /dev/null and b/test/bytecode_3.7/01_map_unpack.pyc differ diff --git a/test/bytecode_3.7/01_matrix_multiply.pyc b/test/bytecode_3.7/01_matrix_multiply.pyc new file mode 100644 index 00000000..1a5b854b Binary files /dev/null and b/test/bytecode_3.7/01_matrix_multiply.pyc differ diff --git a/uncompyle6/parsers/parse37.py b/uncompyle6/parsers/parse37.py index a7cb105f..341e1a4b 100644 --- a/uncompyle6/parsers/parse37.py +++ b/uncompyle6/parsers/parse37.py @@ -35,6 +35,13 @@ class Python37Parser(Python36Parser): # Is there a pattern here? attributes ::= IMPORT_FROM ROT_TWO POP_TOP IMPORT_FROM + + # FIXME: generalize and specialize + attribute37 ::= LOAD_NAME LOAD_METHOD + expr ::= attribute37 + + # FIXME: generalize and specialize + call ::= expr CALL_METHOD_0 """ class Python37ParserSingle(Python37Parser, PythonParserSingle): diff --git a/uncompyle6/scanners/scanner3.py b/uncompyle6/scanners/scanner3.py index ecfbe7ed..b1334b11 100644 --- a/uncompyle6/scanners/scanner3.py +++ b/uncompyle6/scanners/scanner3.py @@ -140,7 +140,7 @@ class Scanner3(Scanner): self.opc.BUILD_MAP, self.opc.UNPACK_SEQUENCE, self.opc.RAISE_VARARGS]) - if is_pypy: + if is_pypy or self.version >= 3.7: varargs_ops.add(self.opc.CALL_METHOD) if self.version >= 3.5: varargs_ops |= set([self.opc.BUILD_SET_UNPACK, @@ -179,7 +179,7 @@ class Scanner3(Scanner): bytecode = self.build_instructions(co) - # show_asm = 'after' + # show_asm = 'both' if show_asm in ('both', 'before'): for instr in bytecode.get_instructions(co): print(instr.disassemble()) @@ -347,9 +347,9 @@ class Scanner3(Scanner): else: opname = '%s_%d' % (opname, pos_args) - elif self.is_pypy and opname in ('CALL_METHOD', 'JUMP_IF_NOT_DEBUG'): + elif self.is_pypy and opname == 'JUMP_IF_NOT_DEBUG': # The value in the dict is in special cases in semantic actions, such - # as CALL_FUNCTION. The value is not used in these cases, so we put + # as JUMP_IF_NOT_DEBUG. The value is not used in these cases, so we put # in arbitrary value 0. customize[opname] = 0 elif opname == 'UNPACK_EX': diff --git a/uncompyle6/semantics/customize3.py b/uncompyle6/semantics/customize3.py index 1aa106ba..69defdc6 100644 --- a/uncompyle6/semantics/customize3.py +++ b/uncompyle6/semantics/customize3.py @@ -879,6 +879,13 @@ def customize_for_version3(self, version): self.prune() return self.n_return_closure = return_closure + + if version >= 3.7: + PRECEDENCE['attribute37'] = 2 + TABLE_DIRECT.update({ + 'attribute37': ( '%c.%[1]{pattr}', 0 ), + }) + pass pass # version >= 3.6 pass # version >= 3.4 return