Intro
Introduction to CPython
- 1.1 What Is CPython?
- 1.2 The Evolution to Version 3.15
Getting the CPython Source Code
- 2.1 The CPython Repository
- 2.2 Cloning the CPython 3.15 Source
- 2.3 Compiling CPython 3.15 from Source
- What’s next
Reading CPython Source Code Effectively
- 3.1: Coding Conventions and Macro‑Heavy Patterns
- 3.2: Navigating the Source Tree
- 3.3: Tracing Object Lifecycles
- 3.4: Debugging Crashes in CPython
The CPython Object Model
- 4.1 Everything Is an Object
- 4.2 Fundamental Data Types in Depth
- 4.3 The Descriptor Protocol and Attribute Lookup
Memory Management
- 5.1: The CPython Memory Allocator Stack
- 5.2: Reference Counting – In Depth
- 5.3: The Cyclic Garbage Collector (GC)
The Execution Model
- 6.1 From Source Code to Bytecode
- 6.2 The Frame and Execution Stack
- 6.3 The Bytecode Interpreter
- 6.4 The Two‑Tier Interpreter Architecture
- 6.5 Calling Conventions and Vectorcall
The Global Interpreter Lock (GIL)
- 7.1 What Is the GIL and Why Does It Exist?
- 7.2 How the GIL Works in CPython 3.15
- 7.3 The Free‑Threaded Build (No‑GIL)
- 7.4 Connecting to the Previous Chapter
- 7.5 Preview of the Next Chapter
Chapter 8: Subinterpreters and Isolated Execution
- 8.1 What Are Subinterpreters?
- 8.2 The
PyInterpreterStateandPyThreadState - 8.3 Interpreter State Isolation in 3.15
The JIT Compiler in CPython 3.15
- 9.1 Introduction to Just‑In‑Time (JIT) Compilation
- 9.2 How the JIT Works in 3.15
- 9.3 JIT Performance in Practice
Bytecode and Optimization
- 10.1 Python Bytecode in 3.15
- 10.2 The Supercompiler and Adaptive Interpreter
- 10.3 Performance Tuning
I/O and Performance Optimizations
- 11.1 Faster I/O in CPython 3.15
- 11.2 Asynchronous I/O and the Event Loop
The CPython Module System
- 12.1: Built‑in Modules vs. Extension Modules
- 12.2: The Import System Internals
- 12.3: Loading and Initializing Extension Modules
- 12.4: Lazy Imports (PEP 810)
- End of Chapter 12
The C API
- 13.1 The Three API Layers
- 13.2 The abi3t Proposal
- 13.3 Module Initialization
- 13.4 Free‑Threading Compatibility
- 13.5 What Does Not Change
- 13.6 Vectorcall
- 13.7 Writing an Extension for 3.15
- 13.8 Testing
- Summary
Embedding CPython
- 14.1: Embedding Python in a C Application
- 14.2: Subinterpreters in Embedded Environments
- 14.3: WebAssembly and CPython 3.15
Security and SSL/TLS
- 15.1: SSL/TLS Enhancements in 3.15
- 15.2: Security Best Practices for Extensions
Debugging and Profiling CPython
- 16.1 Debugging with GDB
- 16.2 The New Statistical Profiler (PEP 799)
- 16.3 Tracing and Instrumentation
The Build System and Cross‑Compilation
- 17.1 The CPython Build System
- 17.2 Cross‑Compiling CPython
- Chapter Summary
CPython Contributor’s Workflow
- 18.1: Setting Up a Development Environment
- 18.2: Argument Clinic
- 18.3: Testing CPython
- 18.4: Continuous Integration and Buildbots
- 18.5: Benchmarking and Performance
- 18.6: Working with Generated Files