Low Level Python a Deep dive into the python sources
summary
Walks through CPython internals with concrete pointers: using dis.py to see bytecode, .pyc files with magic bytes and timestamp, and the interpreter entry in main.c. Shows the bytecode loop in PyEval_EvalFrameEx, frame objects and value stack, and that generators are objects holding code, frame and locals. Explains refcounted PyObject type system, GCC computed-goto in the sources, allocator layout with 256 KB arenas split into 4 KB pools, and why freed memory rarely returns to the OS.
AI-written summary · about
chapters (12)
- 0:00Introduction to low-level Python
- 1:50Python interpreter and bytecode
- 3:15CPython source code overview
- 5:07Opcode implementation in eval.c
- 6:57Frame objects and execution model
- 8:26Python object types and memory
- 9:30Python memory management
- 11:58Function objects and closures
- 13:33Spaghetti code in CPython
- 14:37Iterators and generators
- 16:50Class objects and metaclasses
- 19:02Summary and key takeaways
related talks
31mUnderstanding Python from the inside: C concepts to dive into CPython fearless
32mBytecode and .pyc files
50mExploring CPython's bytecode
02h 26mPointers in Python
30mA Bit about Bytes: Understanding Python Bytecode
50mExploring CPython's bytecode
01h 21mExploring Python Code Objects
34mCPython internals and the VM
