A walk with CPython
summary
Explains exactly what CPython does: source code goes through python -m tokenize into tokens, a PEG parser builds an AST, that becomes a control‑flow graph and a flattened list of bytecode opcodes (LOAD_FAST, CALL_FUNCTION, RETURN_VALUE) which the interpreter executes in a single loop. Shows how to inspect bytecode with python -m dis, describes computed goto dispatch and the PEP 659 specializing adaptive interpreter (≈25% speedup in 3.11), warmup/miss counters, frames and a no‑GIL roadmap.
AI-written summary · about
chapters (20)
- 0:00Introduction to CPython
- 1:29What is CPython
- 2:31Talk overview and expectations
- 3:53Compiler steps in CPython
- 7:08Tokenization and parsing
- 9:18Control flow graph explained
- 10:22Disassembly and op codes
- 11:48Interpreter execution loop
- 14:22Understanding op codes
- 16:06Computed goto optimization
- 17:31Specializing adaptive interpreter
- 20:20Frames and memory management
- 22:38Program execution walkthrough
- 23:00Resources for deeper learning
- 24:51Tools to inspect CPython internals
- 26:35Python 3.11 performance highlights
- 27:58Future of Global Interpreter Lock
- 29:00CPython op codes vs JVM bytecode
- 30:04Hooking into CPython internals
- 31:07Q&A and closing
