From 420d22c0946bb9b7e2551905d6ad36fb2686766d Mon Sep 17 00:00:00 2001 From: rocky Date: Fri, 15 Apr 2022 08:32:57 -0400 Subject: [PATCH] Correct for pypy 3.7 --- uncompyle6/scanners/pypy37.py | 4 ++-- uncompyle6/scanners/scanner37.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/uncompyle6/scanners/pypy37.py b/uncompyle6/scanners/pypy37.py index 64589525..6856c839 100644 --- a/uncompyle6/scanners/pypy37.py +++ b/uncompyle6/scanners/pypy37.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 by Rocky Bernstein +# Copyright (c) 2021-2022 by Rocky Bernstein """ Python PyPy 3.7 decompiler scanner. @@ -6,7 +6,7 @@ Does some additional massaging of xdis-disassembled instructions to 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 from xdis.opcodes import opcode_37pypy as opc # is this right? diff --git a/uncompyle6/scanners/scanner37.py b/uncompyle6/scanners/scanner37.py index 0dde1cf0..8a1de663 100644 --- a/uncompyle6/scanners/scanner37.py +++ b/uncompyle6/scanners/scanner37.py @@ -32,8 +32,9 @@ JUMP_OPs = opc.JUMP_OPS 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) + self.is_pypy = is_pypy return pass @@ -56,7 +57,7 @@ class Scanner37(Scanner37Base): pass elif t.op == self.opc.BUILD_MAP_UNPACK_WITH_CALL: 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 pass return tokens, customize