Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Exploring CPython's Bytecode

EuroPython Conference via YouTube

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Dive into the inner workings of CPython's bytecode in this 50-minute EuroPython Conference talk. Explore the compilation process, virtual machine execution, and bytecode structure. Unravel the mysteries of .pyc files, code objects, and the disassembler. Learn how to compile your own code objects and gain insights into bytecode arguments and the evaluation loop. Examine various bytecode instructions, including LOAD_FAST, BINARY_MULTIPLY, and CALL_FUNCTION. Discover techniques for abusing bytecode and improving tracing. Gain a deeper understanding of Python's internals and enhance your programming skills through this comprehensive exploration of CPython's bytecode mechanics.

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

Reviews

Start your review of Exploring CPython's Bytecode

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.