Under The Hood
backend python CPython 3.13+ / 3.14 (free-threaded build)

Free-Threaded Python (PEP 703): GIL Removal and Per-Object Locking

Last updated
Prerequisites:
CPython GIL architecture
Thread safety & race conditions
  • python
  • pep-703
  • free-threading
  • no-gil
  • cpython
  • concurrency
  • multithreading

Read at your depth

The practical view

Free-threaded Python (introduced experimentally in Python 3.13 via PEP 703 and built with `--disable-gil`) allows standard Python threads (`threading.Thread`) to execute in true parallel across multiple CPU cores without being blocked by the Global Interpreter Lock (GIL). You can check if the GIL is disabled using `import sys; sys._is_gil_enabled()`.

The same idea in other frameworks

python equivalent
CPython `--disable-gil` (free-threaded build with biased reference counting).

Legacy vs modern

GIL-Locked Threading (Standard Python) vs True Parallel Multi-Threading (Python 3.13t)

Standard Python threads run sequentially on 1 core; free-threaded Python achieves true linear multi-core scaling.

before → after
Standard CPython (GIL Enabled)
python3.13 app.py # ❌ CPU-bound threads serialize on 1 core
Free-Threaded Python 3.13t (GIL Disabled)
python3.13t parallel_benchmark.py # ✅ NEW: Runs in parallel across 4 cores (~1.1s)

Interview gotchas

Context

This is the most critical conceptual trap regarding PEP 703.

The mechanical answer

**NO.** Removing the GIL only makes the *Python C runtime and interpreter internals* thread-safe. **User-level race conditions still exist.** If two threads mutate a shared Python dictionary or list without a `threading.Lock`, they can overwrite each other's data (lost updates). While the interpreter won't crash with memory corruption (due to internal `PyMutex` locks), your application business logic still requires explicit synchronization locks.

Trap

Removing the GIL eliminates interpreter serialization, but increases the necessity of `threading.Lock` in user code.

Under The Hood — a multi-depth technical interview hub.

Third-party licenses Press ⌘ K to search.