My slides from PyCon China 2026 are now available: One Bug as a Doorway into CPython — Learning the Interpreter through Free-Threading Bugs.
Open or download the slides (PDF, 28 pages)
The talk follows a concrete concurrency bug as a way to learn a large codebase: start with observable behavior, reproduce the race, trace the Python-to-C call path, and work out which ownership and synchronization rules the code relies on.
Inside the talk
- A race involving
ThreadHandle.ident, from the initial report to a focused reproducer. - How ThreadSanitizer evidence, call stacks, and source reading help build a model of the bug.
- Why ownership scope matters when choosing a synchronization mechanism.
- How to validate a fix against the model, rather than just making a warning disappear.
- A dataclass initialization performance case, where poor scaling replaces a crash as the starting point.
- What these investigations suggest about clearer concurrency contracts and contributing to CPython.
Case studies and resources
- Race report: CPython issue #154937
- Race fix: CPython PR #155085
- Performance case: CPython PR #141596
- CPython Developer Guide
- PEP 703: Making the Global Interpreter Lock Optional in CPython
- Conference talk page
You can also find this deck on the Slides page.