You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
README.rst: note addition of pydisassemble
Remove duplicate disassembly printing from scanners and put common code in caller(s). Show source-code line numbers in disassembly output and fix alignment of byte offsets. disas.py: workaround Python 2/3 different layouts before we get to bytecodes in a code object.
This commit is contained in:
@@ -38,11 +38,11 @@ def disassemble_code(version, co, out=None):
|
||||
assert isinstance(co, types.CodeType)
|
||||
|
||||
# store final output stream for case of error
|
||||
__real_out = out or sys.stdout
|
||||
print('# Python %s' % version, file=__real_out)
|
||||
real_out = out or sys.stdout
|
||||
print('# Python %s' % version, file=real_out)
|
||||
if co.co_filename:
|
||||
print('# Embedded file name: %s' % co.co_filename,
|
||||
file=__real_out)
|
||||
file=real_out)
|
||||
|
||||
# Pick up appropriate scanner
|
||||
if version == 2.7:
|
||||
@@ -63,6 +63,11 @@ def disassemble_code(version, co, out=None):
|
||||
scanner.setShowAsm(True, out)
|
||||
tokens, customize = scanner.disassemble(co)
|
||||
|
||||
for t in tokens:
|
||||
print(t, file=real_out)
|
||||
print(file=out)
|
||||
|
||||
|
||||
|
||||
def disassemble_file(filename, outstream=None, showasm=False, showast=False):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user