Fallout from more precise token attributes

This commit is contained in:
rocky
2018-02-28 23:35:52 -05:00
parent 413df51dfa
commit e23315b2e6
8 changed files with 39 additions and 8 deletions

View File

@@ -39,7 +39,9 @@ from collections import namedtuple
from array import array
from xdis.code import iscode
from xdis.bytecode import Bytecode, op_has_argument, instruction_size
from xdis.bytecode import (
Bytecode, op_has_argument, instruction_size,
_get_const_info)
from xdis.util import code2num
from uncompyle6.scanner import Scanner
@@ -233,7 +235,13 @@ class Scanner2(Scanner):
# (id(const), const.co_filename, const.co_name)
pattr = '<code_object ' + const.co_name + '>'
else:
if oparg < len(co.co_consts):
argval, _ = _get_const_info(oparg, co.co_consts)
# Why don't we use _ above for "pattr" rather than "const"?
# This *is* a little hoaky, but we have to coordinate with
# other parts like n_LOAD_CONST in pysource.py for example.
pattr = const
pass
elif op in self.opc.NAME_OPS:
pattr = names[oparg]
elif op in self.opc.JREL_OPS: