Overview
Syllabus
Intro
Unravelling Bytecode
Python: Compiler & VM
Python overview
Example Module
Executing the Bytecode
Optimisation
Structure of .pyc Files
Magic Number
Timestamp
Code Object Marshal module
Back to the Compiler Compile your own code object
Code Objects It's documented: Data model (Language Reference) Everything which is executed becomes a code
sum Code Object
Disassembler
First Taste of Bytecode (2) LOAD FAST
First Model of the VM
Reading Bytecode
Bytecode Arguments dis HAVE ARGUMENT = 90
First Eval Loop
Passing Arguments
Handling Bytecodes
LOAD FAST LOAD CONST
BINARY MULTIPLY
BINARY ADD
RETURN VALUE
The VM So Far
Disassembling the Module
STORE NAME LOAD NAME
CALL FUNCTION (2)
POP JUMP_IF_FALSE
JUMP FORWARD . POP TOP
Incomplete
EXTENDED ARG
Abusing Bytecode
The Tools
Improve Tracing
Questions
Taught by
EuroPython Conference