You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Double -a option show asm before tokenization
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2015-2020, 2022 by Rocky Bernstein
|
||||
# Copyright (c) 2015-2020, 2022-2023 by Rocky Bernstein
|
||||
# Copyright (c) 2005 by Dan Pascu <dan@windowmaker.org>
|
||||
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
|
||||
#
|
||||
@@ -219,10 +219,17 @@ class Scanner37Base(Scanner):
|
||||
|
||||
bytecode = self.build_instructions(co)
|
||||
|
||||
# show_asm = 'both'
|
||||
if show_asm in ("both", "before"):
|
||||
for instr in bytecode.get_instructions(co):
|
||||
print(instr.disassemble(self.opc))
|
||||
print("\n# ---- before tokenization:")
|
||||
bytecode.disassemble_bytes(
|
||||
co.co_code,
|
||||
varnames=co.co_varnames,
|
||||
names=co.co_names,
|
||||
constants=co.co_consts,
|
||||
cells=bytecode._cell_names,
|
||||
linestarts=bytecode._linestarts,
|
||||
asm_format="extended",
|
||||
)
|
||||
|
||||
# "customize" is in the process of going away here
|
||||
customize = {}
|
||||
@@ -525,6 +532,7 @@ class Scanner37Base(Scanner):
|
||||
pass
|
||||
|
||||
if show_asm in ("both", "after"):
|
||||
print("\n# ---- after tokenization:")
|
||||
for t in tokens:
|
||||
print(t.format(line_prefix=""))
|
||||
print()
|
||||
|
Reference in New Issue
Block a user