Limited support for Python 2.3

This commit is contained in:
rocky
2016-06-03 10:09:39 -04:00
parent eefbc40eef
commit ebcb1d08f4
20 changed files with 1301 additions and 76 deletions

View File

@@ -40,10 +40,10 @@ import uncompyle6.scanner as scan
class Scanner3(scan.Scanner):
def __init__(self, version, show_asm=False):
def __init__(self, version, show_asm=None):
super(Scanner3, self).__init__(version, show_asm)
def disassemble(self, co, classname=None, code_objects={}):
def disassemble(self, co, classname=None, code_objects={}, show_asm=None):
"""
Disassemble a Python 3 code object, returning a list of 'Token'.
Various tranformations are made to assist the deparsing grammar.
@@ -55,7 +55,11 @@ class Scanner3(scan.Scanner):
dis.disassemble().
"""
# import dis; dis.disassemble(co) # DEBUG
show_asm = self.show_asm if not show_asm else show_asm
if self.show_asm in ('both', 'before'):
bytecode = Bytecode(co, self.opc)
for instr in bytecode.get_instructions(co):
print(instr._disassemble())
# Container for tokens
tokens = []