Correct for pypy 3.7

This commit is contained in:
rocky
2022-04-15 08:32:57 -04:00
parent faac21d1e4
commit 420d22c094
2 changed files with 5 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2021 by Rocky Bernstein # Copyright (c) 2021-2022 by Rocky Bernstein
""" """
Python PyPy 3.7 decompiler scanner. Python PyPy 3.7 decompiler scanner.
@@ -6,7 +6,7 @@ Does some additional massaging of xdis-disassembled instructions to
make things easier for decompilation. make things easier for decompilation.
""" """
import decompyle3.scanners.scanner37 as scan import uncompyle6.scanners.scanner37 as scan
# bytecode verification, verify(), uses JUMP_OPS from here # bytecode verification, verify(), uses JUMP_OPS from here
from xdis.opcodes import opcode_37pypy as opc # is this right? from xdis.opcodes import opcode_37pypy as opc # is this right?

View File

@@ -32,8 +32,9 @@ JUMP_OPs = opc.JUMP_OPS
class Scanner37(Scanner37Base): class Scanner37(Scanner37Base):
def __init__(self, show_asm=None): def __init__(self, show_asm=None, is_pypy: bool=False):
Scanner37Base.__init__(self, (3, 7), show_asm) Scanner37Base.__init__(self, (3, 7), show_asm)
self.is_pypy = is_pypy
return return
pass pass
@@ -56,7 +57,7 @@ class Scanner37(Scanner37Base):
pass pass
elif t.op == self.opc.BUILD_MAP_UNPACK_WITH_CALL: elif t.op == self.opc.BUILD_MAP_UNPACK_WITH_CALL:
t.kind = "BUILD_MAP_UNPACK_WITH_CALL_%d" % t.attr t.kind = "BUILD_MAP_UNPACK_WITH_CALL_%d" % t.attr
elif t.op == self.opc.BUILD_TUPLE_UNPACK_WITH_CALL: elif not self.is_pypy and t.op == self.opc.BUILD_TUPLE_UNPACK_WITH_CALL:
t.kind = "BUILD_TUPLE_UNPACK_WITH_CALL_%d" % t.attr t.kind = "BUILD_TUPLE_UNPACK_WITH_CALL_%d" % t.attr
pass pass
return tokens, customize return tokens, customize