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:
@@ -205,10 +205,17 @@ class Scanner2(Scanner):
|
||||
|
||||
bytecode = self.build_instructions(co)
|
||||
|
||||
# show_asm = 'after'
|
||||
if show_asm in ("both", "before"):
|
||||
for instr in bytecode.get_instructions(co):
|
||||
print(instr.disassemble())
|
||||
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",
|
||||
)
|
||||
|
||||
# list of tokens/instructions
|
||||
new_tokens = []
|
||||
@@ -483,6 +490,7 @@ class Scanner2(Scanner):
|
||||
pass
|
||||
|
||||
if show_asm in ("both", "after"):
|
||||
print("\n# ---- after tokenization:")
|
||||
for t in new_tokens:
|
||||
print(t.format(line_prefix=""))
|
||||
print()
|
||||
|
Reference in New Issue
Block a user