What's New in Python 3.14
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 <script>alert(1)</script></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
exceptandexcept*can list several exception types without parentheses:except ValueError, TypeError:.- A new
compression.zstdmodule adds Zstandard compression to the standard library. - Multiple interpreters in one process are available from Python via
concurrent.interpreters. return,breakandcontinueinsidefinallynow 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.
Comments
No comments yet. Have a question or a tip? Be the first to share it.