Python 3.13 New Features — Core Concepts

What changed in Python 3.13

Released in October 2024, Python 3.13 shipped two experimental features that could reshape Python’s future — free threading (no-GIL) and a JIT compiler — alongside a long-overdue REPL redesign and official mobile platform support.

Free-threaded mode (PEP 703)

Python’s Global Interpreter Lock (GIL) has prevented true multi-threaded parallelism since 1992. Python 3.13 offers an experimental build that removes it.

How to use it

Free-threaded Python is a separate build, installed alongside regular Python:

# On Linux/macOS (via pyenv or deadsnakes PPA)
pyenv install 3.13t    # 't' suffix = free-threaded build

# Verify
python3.13t -c "import sys; print(sys._is_gil_enabled())"
# False — GIL is disabled

What changes

With the GIL removed, threads can truly run Python code in parallel:

import threading, time

def compute(n):
    total = 0
    for i in range(n):
        total += i * i
    return total

# With GIL: ~4 seconds (sequential despite threads)
# Without GIL: ~1 second on 4 cores
threads = [threading.Thread(target=compute, args=(10_000_000,)) for _ in range(4)]
for t in threads: t.start()
for t in threads: t.join()

Current limitations

  • Experimental — not recommended for production
  • Single-threaded code is ~5-10% slower due to fine-grained locking overhead
  • Many C extensions aren’t thread-safe — NumPy, pandas, etc. need updates
  • pip install packages may not have free-threaded wheels yet

Experimental JIT compiler (PEP 744)

Python 3.13 includes a “copy-and-patch” JIT that compiles hot bytecode to machine code at runtime.

How it works

  1. The adaptive interpreter (from 3.11) identifies specialised bytecodes
  2. When a trace of specialised bytecodes becomes hot, the JIT kicks in
  3. Pre-compiled machine code “stencils” are stitched together for the specific instruction sequence
  4. The result is native machine code that runs without interpreter overhead

Current impact

The JIT is disabled by default and provides modest speedups (0-9%) in initial benchmarks. It’s a foundation for future optimisations — the architecture enables advanced techniques like inlining and constant folding that will come in 3.14+.

Enable it with: PYTHON_JIT=1 python3.13 script.py

Redesigned interactive REPL

The Python prompt got its biggest upgrade since its creation:

  • Syntax highlighting — keywords, strings, and numbers are colour-coded
  • Multi-line editing — press up to recall and edit entire blocks, not just single lines
  • Block-aware historyfor loops and if blocks are recalled as complete units
  • Better paste handling — paste multi-line code and it’s handled correctly
  • F2 to open an editor — for complex multi-line editing

The new REPL is built on _pyrepl (derived from PyPy’s repl), replacing the old readline-based prompt.

iOS and Android support (PEP 730, PEP 738)

Python is now officially a Tier 3 supported platform on iOS and Android:

  • CPython compiles to iOS frameworks and Android shared libraries
  • Apps like Beeware and Kivy can embed Python as a framework
  • Test suite passes on both platforms
  • This doesn’t mean Python apps appear in app stores easily — it means the runtime is officially supported and tested

Improved locals() semantics (PEP 667)

locals() now returns a snapshot (copy) every time, not a view of the frame’s local variables:

def example():
    x = 1
    d = locals()
    x = 2
    print(d["x"])  # Prints 1 in 3.13 (snapshot), was implementation-dependent before

This fixes a long-standing source of confusion and bugs.

Deprecations and removals

  • aifc, audioop, chunk, cgi, cgitb, imghdr, mailcap, msilib, ossaudiodev, pipes, sndhdr, sunau, telnetlib, uu, xdrlib — all removed (deprecated in 3.11)
  • typing.TypedDict __extra_items__ — new way to type extra keys

Common misconception

“Python 3.13 removes the GIL.” Not exactly. The default build still has the GIL. Free-threaded mode is a separate, experimental build. Most users won’t run it yet, and most libraries don’t support it. The GIL isn’t going away overnight — this is year one of a multi-year transition.

The one thing to remember: Python 3.13 is the beginning of Python’s parallel future — free threading and JIT compilation are experimental today, but they’ll define how Python evolves over the next decade.

pythonpython313release-features

See Also

  • Python 310 New Features Python 3.10 gave programmers a shape-sorting machine, friendlier error messages, and cleaner ways to say 'this or that' in type hints.
  • Python 311 New Features Python 3.11 made everything faster, error messages smarter, and let you catch several mistakes at once instead of stopping at the first one.
  • Python 312 New Features Python 3.12 made type hints shorter, f-strings more powerful, and started preparing Python's engine for a world without the GIL.
  • Python Exception Groups Python's ExceptionGroup is like getting one report card that lists every mistake at once instead of stopping at the first one.
  • Python Free Threading Nogil Python has always had a rule that only one thing can happen at a time — free threading finally changes that, like opening extra checkout lanes at the grocery store.