forked from Rust-related/RustPython
19 lines
491 B
Python
Vendored
19 lines
491 B
Python
Vendored
from _dis import *
|
|
|
|
|
|
# Disassembling a file by following cpython Lib/dis.py
|
|
def _test():
|
|
"""Simple test program to disassemble a file."""
|
|
import argparse
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('infile', type=argparse.FileType('rb'), nargs='?', default='-')
|
|
args = parser.parse_args()
|
|
with args.infile as infile:
|
|
source = infile.read()
|
|
code = compile(source, args.infile.name, "exec")
|
|
dis(code)
|
|
|
|
if __name__ == "__main__":
|
|
_test()
|