Contribute Media
A thank you to everyone who has made this possible: Read More

CPython byte-code and code-injection



Want to know what makes CPython interpreter's engine tick?

How about modifying Python's bytecode or maybe modifying it live in another running Python process?


In this talk we will go into what is in a Python .pyc file and how CPython executes that bytecode (mainly by looking at the code object). Afterwards we will talk about how to make simple modifications to the bytecode in order to insert hook points into preexisting code. We will see how we can use pyrasite for inspecting and modifying an already running Python process (useful for debugging long-running servers or detecting memory leaks). Finally, we will survey some more generic Python bytecode modifiers and code injectors.

Bonus points:

Slides available here: and here:

Improve this page