

I'll try to keep track of important changes and add update notes. Some implementation details will certainly change as CPython evolves. Note: In this post I'm referring to CPython 3.9. This job is done by the CPython compiler. So CPython must be able to create a code object from a source code.

Typically, a Python programmer doesn't write bytecode and doesn't create the code objects but writes a normal Python code. A code object contains the block's bytecode, the constants and the names of variables used within the block and the block's various properties. To execute a code block such as a module or a function means to execute a corresponding code object. That's why there exists a notion of a code object. We've also seen that Python bytecode is not sufficient to fully describe what a piece of code does. We've learned that it works by executing a series of instructions called bytecode. In the first post of the series we've looked at the CPython VM.

Tags: Python behind the scenes Python CPython Today's subject
