You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Partial sync of 3.7 & 3.8 scanner with decompyle3
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
Python 3.7 bytecode decompiler scanner
|
||||
Python 3.7 bytecode decompiler scanner.
|
||||
|
||||
Does some additional massaging of xdis-disassembled instructions to
|
||||
make things easier for decompilation.
|
||||
@@ -33,10 +33,11 @@ from xdis.opcodes import opcode_37 as opc
|
||||
# bytecode verification, verify(), uses JUMP_OPS from here
|
||||
JUMP_OPs = opc.JUMP_OPS
|
||||
|
||||
|
||||
class Scanner37(Scanner37Base):
|
||||
def __init__(self, show_asm=None, is_pypy: bool=False):
|
||||
Scanner37Base.__init__(self, (3, 7), show_asm)
|
||||
self.is_pypy = is_pypy
|
||||
def __init__(self, show_asm=None, debug="", is_pypy=False):
|
||||
Scanner37Base.__init__(self, (3, 7), show_asm, debug, is_pypy)
|
||||
self.debug = debug
|
||||
return
|
||||
|
||||
pass
|
||||
@@ -139,7 +140,9 @@ class Scanner37(Scanner37Base):
|
||||
grammar rules. Specifically, variable arg tokens like MAKE_FUNCTION or BUILD_LIST
|
||||
cause specific rules for the specific number of arguments they take.
|
||||
"""
|
||||
tokens, customize = Scanner37Base.ingest(self, co, classname, code_objects, show_asm)
|
||||
tokens, customize = Scanner37Base.ingest(
|
||||
self, co, classname, code_objects, show_asm
|
||||
)
|
||||
new_tokens = []
|
||||
for i, t in enumerate(tokens):
|
||||
# things that smash new_tokens like BUILD_LIST have to come first.
|
||||
@@ -179,6 +182,7 @@ class Scanner37(Scanner37Base):
|
||||
|
||||
return new_tokens, customize
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from xdis.version_info import PYTHON_VERSION_TRIPLE, version_tuple_to_str
|
||||
|
||||
@@ -191,4 +195,4 @@ if __name__ == "__main__":
|
||||
print(t.format())
|
||||
pass
|
||||
else:
|
||||
print("Need to be Python 3.7 to demo; I am version %s" % version_tuple_to_str())
|
||||
print(f"Need to be Python 3.7 to demo; I am version {version_tuple_to_str()}.")
|
||||
|
Reference in New Issue
Block a user