Free-Threaded Mode in Python 3.14

Python 3.14 marks a historic milestone: free-threaded mode (no GIL) is officially supported. The interpreter can now run multiple Python threads in parallel across multiple cores, without the Global Interpreter Lock (GIL) that previously limited true parallelism.

How to Enable It

Free-threaded mode requires a specific CPython build. Official installers offer this variant. You can check the active mode with sys.flags.

python
import sys
import sysconfig

# Check if the GIL is disabled
print(sys._is_gil_enabled())  # False in free-threaded mode

# Check ABI suffix (t = free-threaded)
suffix = sysconfig.get_config_var('SOABI')
print(suffix)  # cpython-314t-x86_64-linux-gnu
#                            ^ 't' = free-threaded

Example: True Thread Parallelism

With the GIL disabled, CPU-bound threads actually run in parallel. Speedup is near-linear with the number of cores for pure computation.

python
import threading
import time


def heavy_computation(n: int) -> int:
    """Sum of squares from 0 to n."""
    total = 0
    for i in range(n):
        total += i * i
    return total


N = 10_000_000

# Sequential execution
start = time.perf_counter()
for _ in range(4):
    heavy_computation(N)
seq = time.perf_counter() - start

# Parallel execution with threads
start = time.perf_counter()
threads = [threading.Thread(target=heavy_computation, args=(N,)) for _ in range(4)]
for t in threads:
    t.start()
for t in threads:
    t.join()
par = time.perf_counter() - start

print(f"Sequential: {seq:.2f}s")
print(f"Parallel:   {par:.2f}s")
print(f"Speedup:    {seq / par:.1f}x")
# With free-threaded: ~3.5x on 4 cores
# With classic GIL:   ~1.0x (no speedup)

Sources