tok.format -> tok.__str__; simplify pypy code

This commit is contained in:
rocky
2016-07-27 09:26:39 -04:00
parent 5e801b5d74
commit 3a78332d59
9 changed files with 29 additions and 20 deletions

View File

@@ -130,10 +130,13 @@ class Scanner3(scan.Scanner):
for instr in bytecode.get_instructions(co):
print(instr._disassemble())
customize = {}
# Container for tokens
tokens = []
customize = {}
if self.is_pypy:
customize['PyPy'] = 1;
self.code = array('B', co.co_code)
self.build_lines_data(co)
self.build_prev_op()
@@ -307,7 +310,7 @@ class Scanner3(scan.Scanner):
if show_asm in ('both', 'after'):
for t in tokens:
print(t.format())
print(t)
print()
return tokens, customize
@@ -801,7 +804,7 @@ if __name__ == "__main__":
from uncompyle6 import PYTHON_VERSION
tokens, customize = Scanner3(PYTHON_VERSION).disassemble(co)
for t in tokens:
print(t.format())
print(t)
else:
print("Need to be Python 3.2 or greater to demo; I am %s." %
PYTHON_VERSION)