You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Small 3.7 steps
This commit is contained in:
Binary file not shown.
BIN
test/bytecode_3.7/00_assign.pyc
Normal file
BIN
test/bytecode_3.7/00_assign.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/00_docstring.pyc
Normal file
BIN
test/bytecode_3.7/00_docstring.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/01_augmented_assign.pyc
Normal file
BIN
test/bytecode_3.7/01_augmented_assign.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/01_boolean.pyc
Normal file
BIN
test/bytecode_3.7/01_boolean.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/01_extended_arg.pyc
Normal file
BIN
test/bytecode_3.7/01_extended_arg.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/01_map_unpack.pyc
Normal file
BIN
test/bytecode_3.7/01_map_unpack.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7/01_matrix_multiply.pyc
Normal file
BIN
test/bytecode_3.7/01_matrix_multiply.pyc
Normal file
Binary file not shown.
@@ -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):
|
||||
|
@@ -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':
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user