Fix some 2.6 bytecode bugs

scanner26: disassemble interface has changed
make_function2: was missing ParserError2 import
This commit is contained in:
rocky 2024-07-11 12:05:25 -04:00
parent 3c6e378cc4
commit b0b67e9f34
2 changed files with 10 additions and 3 deletions

View File

@ -81,9 +81,15 @@ class Scanner26(scan.Scanner2):
# show_asm = 'after' # show_asm = 'after'
if show_asm in ("both", "before"): if show_asm in ("both", "before"):
print("\n# ---- disassembly:") print("\n# ---- disassembly:")
for instr in bytecode.get_instructions(co): bytecode.disassemble_bytes(
print(instr.disassemble(self.opc)) 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 # Container for tokens
tokens = [] tokens = []

View File

@ -22,6 +22,7 @@ from itertools import zip_longest
from xdis import code_has_star_arg, code_has_star_star_arg, iscode 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.scanner import Code
from uncompyle6.semantics.helper import ( from uncompyle6.semantics.helper import (
find_all_globals, find_all_globals,