From b0b67e9f34c53ad4a76d5c30d171f10d909f443b Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 11 Jul 2024 12:05:25 -0400 Subject: [PATCH] Fix some 2.6 bytecode bugs scanner26: disassemble interface has changed make_function2: was missing ParserError2 import --- uncompyle6/scanners/scanner26.py | 12 +++++++++--- uncompyle6/semantics/make_function2.py | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/uncompyle6/scanners/scanner26.py b/uncompyle6/scanners/scanner26.py index b15c0d2f..c37b7fde 100755 --- a/uncompyle6/scanners/scanner26.py +++ b/uncompyle6/scanners/scanner26.py @@ -81,9 +81,15 @@ class Scanner26(scan.Scanner2): # show_asm = 'after' if show_asm in ("both", "before"): print("\n# ---- disassembly:") - for instr in bytecode.get_instructions(co): - print(instr.disassemble(self.opc)) - + bytecode.disassemble_bytes( + co.co_code, + varnames=co.co_varnames, + names=co.co_names, + constants=co.co_consts, + cells=bytecode._cell_names, + line_starts=bytecode._linestarts, + asm_format="extended", + ) # Container for tokens tokens = [] diff --git a/uncompyle6/semantics/make_function2.py b/uncompyle6/semantics/make_function2.py index 789e4291..91a0252a 100644 --- a/uncompyle6/semantics/make_function2.py +++ b/uncompyle6/semantics/make_function2.py @@ -22,6 +22,7 @@ from itertools import zip_longest from xdis import code_has_star_arg, code_has_star_star_arg, iscode +from uncompyle6.parser import ParserError as ParserError2 from uncompyle6.scanner import Code from uncompyle6.semantics.helper import ( find_all_globals,