You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Limited support for Python 2.3
This commit is contained in:
@@ -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 = []
|
||||
|
Reference in New Issue
Block a user