Using Rust in Free-Threaded vs Regular Python 3.13
summary
Python 3.13’s free-threaded build enables true parallel Python but exposes data races in native extensions; the talk shows concrete Rust changes and PyO3 edits that make existing extensions safe, including swapping a reference counter for an atomic integers strategy, adding mutex-wrapped internal mutability, and an opt-out reference-tracking mode. Examples include a two-thread counter that reliably reaches 2 million with atomics, a reader/writer tracking scheme that previously raised exceptions, and patterns for locking vs lock-free design.
AI-written summary · about
chapters (11)
- 0:00Rust in Python 3.13
- 1:08Free-Threaded Python
- 3:16Data races in Free-Threaded Python
- 5:41Rust’s aliasing and mutability rules
- 7:27Atomic integers: Rust vs Python
- 8:31Locking shared data
- 9:56PIO3 enforcing Rust rules
- 13:45Rust rules for multi-threaded Python
- 18:00Thread-safe iteration tips
- 19:05Future of Free-Threaded Python
- 20:28Q&A
related talks
46mPython + Rust = ?
31mCan Rust make Python shine?
34mRust for the Python dev
36mPumping up Python modules using Rust
44mDo Pythons Rust? How we used PyO3 to build a Python Stream Processor w/ a Rust Heart
31mPumping up Python modules using Rust
44mHow Python Harnesses Rust through PyO3
57mTechniques learned from five years finding the way for Rust in Python
