/inspect_cpython

Inspect CPython internals

Primary LanguagePython

Inspect CPython

My notes on how to inspect CPython interpreter and it's bytecode

Show Abstract Syntax Tree

python -m ast example_programs/hello.py

Show bytecode

python -m dis example_programs/hello.py

Compile to bytecode

python -m py_compile example_programs/hello.py

Compile to bytecode with marshal

python -m compiler.py example_programs/hello.py output.pyc
python output.pyc

All in one inspection tools

Disassembler, AST and others in one script. See python itools.py --help for options.

python itools.py example_programs/hello.py