Token.format(), shows CONST values better...

We were not showing the proper value for None, or False.

Start a unit test for Token().

I think this cleans the Token class up a little more.

More work is needed for MAKE_FUNCTION...

Note: Some debug stuff is commented out in make_funciton.py for upcoming work.
This commit is contained in:
rocky
2018-02-28 22:05:12 -05:00
parent 1fe432585e
commit 413df51dfa
5 changed files with 53 additions and 8 deletions

View File

@@ -40,7 +40,7 @@ from collections import namedtuple
from array import array
from xdis.code import iscode
from xdis.bytecode import Bytecode, instruction_size
from xdis.bytecode import Bytecode, instruction_size, _get_const_info
from uncompyle6.scanner import Token, parse_fn_counts
import xdis
@@ -340,6 +340,10 @@ class Scanner3(Scanner):
# (id(const), const.co_filename, const.co_name)
pattr = '<code_object ' + const.co_name + '>'
else:
argval, _ = _get_const_info(inst.arg, 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 opname in ('MAKE_FUNCTION', 'MAKE_CLOSURE'):