What's New in Python 3.14

A
Author
02 Oct, 2026 1 min read 1.33K views

Python 3.14 was released in October 2025. Here are the changes most developers will notice.

Template strings (t-strings)

A t-string looks like an f-string but produces a Template object instead of a finished string. Libraries can then process the interpolated values safely, for example escaping HTML or parameterising SQL.

import html
from string.templatelib import Template, Interpolation

name = "<script>alert(1)</script>"
template = t"<p>Hello {name}</p>"

def render_html(tpl: Template) -> str:
    parts = []
    for item in tpl:
        if isinstance(item, Interpolation):
            parts.append(html.escape(str(item.value)))  # escape only user values
        else:
            parts.append(item)
    return "".join(parts)

render_html(template)  # '<p>Hello &lt;script&gt;alert(1)&lt;/script&gt;</p>'

Deferred evaluation of annotations

Annotations are no longer evaluated when a function or class is defined; they're evaluated only when something asks for them. Forward references just work, without quotes or from __future__ import annotations:

class Node:
    def add_child(self, child: Node) -> None:   # no NameError, no quotes needed
        ...

Free-threaded Python is officially supported

The build without the Global Interpreter Lock (GIL), introduced experimentally in 3.13, is now officially supported (it's still a separate build). Threads can run Python code truly in parallel on multiple cores.

Smaller changes worth knowing

  • except and except* can list several exception types without parentheses: except ValueError, TypeError:.
  • A new compression.zstd module adds Zstandard compression to the standard library.
  • Multiple interpreters in one process are available from Python via concurrent.interpreters.
  • return, break and continue inside finally now emit a warning, since they silently swallow exceptions.
  • Even better error messages, with more "did you mean" suggestions.

Upgrading

uv python install 3.14
uv venv --python 3.14
uv run --python 3.14 pytest

Run your test suite on the new version in CI before switching production; most pure-Python code upgrades without changes.

Was this article helpful?

Comments

No comments yet. Have a question or a tip? Be the first to share it.

Leave a comment

Comments are reviewed before they appear.