Releasecore
Python 3.14
Python 3.14 came out on 2025-10-07. It adds deferred annotations, template strings, subinterpreters in the standard library and Zstandard, and it supports free threading.
- Language
- Python
- Version
- 3.14
- Released
- 2025-10-07
- End of life
- 2030-10
What is new
Python 3.14.0 was released on 2025-10-07.1 Its largest changes are template string literals, deferred evaluation of annotations, and subinterpreters in the standard library. The examples on this page ran on CPython 3.14.10 and 3.15.2. Most of them fail on 3.13, because they use syntax or modules that 3.13 does not have.
Deferred evaluation of annotations (PEP 649 and PEP 749)
The interpreter no longer evaluates the annotations of functions, classes and modules when it defines them. It stores them in an annotate function, and it evaluates them only when a program asks for them.4 So an annotation can name a class that is defined later in the file, without quotes.
The new module annotationlib reads annotations in several formats. Format.VALUE evaluates them, as __annotations__ does. Format.FORWARDREF puts a proxy in place of each name that is not defined yet. Format.STRING gives the source text.5
from annotationlib import Format, get_annotations
def move(robot: Robot, steps: int) -> None:
pass
print(get_annotations(move, format=Format.STRING))
try:
get_annotations(move)
except NameError as error:
print("NameError:", error)
class Robot:
pass
print(get_annotations(move))
{'robot': 'Robot', 'steps': 'int', 'return': 'None'}
NameError: name 'Robot' is not defined
{'robot': <class '__main__.Robot'>, 'steps': <class 'int'>, 'return': None}
On 3.13 the def line itself raises NameError, because the interpreter evaluates Robot when it defines the function. See annotations at run time and annotation scopes.
Template string literals (PEP 750)
A string literal with the prefix t makes a string.templatelib.Template object, not a str. The template keeps the static text and each interpolated value apart, so a function can process the values before it joins the parts, for example to escape HTML or to quote SQL.6
from string.templatelib import Interpolation, Template
name = "<script>"
template = t"Hello, {name}!"
print(type(template).__name__)
print(list(template))
def escape(template: Template) -> str:
parts = []
for part in template:
if isinstance(part, Interpolation):
parts.append(str(part.value).replace("<", "<").replace(">", ">"))
else:
parts.append(part)
return "".join(parts)
print(escape(template))
Template
['Hello, ', Interpolation('<script>', 'name', None, ''), '!']
Hello, <script>!
See template string literals and formatted string literals.
Multiple interpreters in the standard library (PEP 734)
The module concurrent.interpreters creates and runs subinterpreters from Python code. Each interpreter has its own modules and its own global state, and each one has its own GIL, so interpreters can run Python code in parallel on several cores.7 The class concurrent.futures.InterpreterPoolExecutor runs tasks in a pool of interpreters.1
from concurrent import interpreters
interp = interpreters.create()
interp.exec("data = [n * n for n in range(5)]; print('in', __name__, data)")
def square(n):
return n * n
print(interp.call(square, 7))
print(len(interpreters.list_all()))
interp.close()
in __main__ [0, 1, 4, 9, 16]
49
2
The code in the new interpreter runs as its own __main__ module. See subinterpreters.
except without brackets and control flow in finally (PEP 758 and PEP 765)
An except or except* clause can list several exception types without brackets, when it has no as clause.8 A return, break or continue statement that leaves a finally block now gives a SyntaxWarning at compile time, because it silently cancels an exception that is in flight.9
import warnings
try:
int("x")
except ValueError, TypeError:
print("caught")
with warnings.catch_warnings(record=True) as caught:
warnings.simplefilter("always")
compile("def f():\n try:\n pass\n finally:\n return 1\n", "<demo>", "exec")
print(caught[0].category.__name__, caught[0].message)
caught
SyntaxWarning 'return' in a 'finally' block
Zstandard and the compression package (PEP 784)
The new package compression holds the module compression.zstd, which binds the Zstandard library. It also re-exports lzma, bz2, gzip and zlib as compression.lzma and the other names. The old module names are not deprecated.11 The modules tarfile, zipfile and shutil can read and write Zstandard archives.1
from compression import zstd
data = b"Python 3.14 " * 1000
packed = zstd.compress(data)
print(len(data), len(packed) < 100, zstd.decompress(packed) == data)
12000 True True
See data compression.
Free threading is supported (PEP 779)
The free-threaded build, which runs without the GIL, was experimental in 3.13. In 3.14 it is officially supported, but it is still not the default build.12 The specializing adaptive interpreter now works in this build, and the cost for single-threaded code is roughly 5 to 10 percent, by platform and compiler.1 See free-threaded Python.
Safe external debugger interface (PEP 768)
sys.remote_exec(pid, script) asks a running Python process to run a script at its next safe point. A debugger can attach to a live process this way, for example with python -m pdb -p PID.10 The variable PYTHON_DISABLE_REMOTE_DEBUG, the option -X disable-remote-debug and the configure flag --without-remote-debug turn the feature off.1
Better error messages
The interpreter suggests the right keyword when a word is close to one. It names the problem when a statement comes after the else of a conditional expression. A key or set element that is not hashable gets a message that says which role the value had.13
import traceback
for source in ("whille True:\n pass\n", "x = 1 if True else pass\n"):
try:
compile(source, "<demo>", "exec")
except SyntaxError as error:
print(traceback.format_exception_only(error)[-1], end="")
try:
{}[[1, 2]] = 3
except TypeError as error:
print("TypeError:", error)
SyntaxError: invalid syntax. Did you mean 'while'?
SyntaxError: expected expression after 'else', but statement is given
TypeError: cannot use 'list' as a dict key (unhashable type: 'list')
The same program on 3.13 and older prints shorter messages:
import traceback
for source in ("whille True:\n pass\n", "x = 1 if True else pass\n"):
try:
compile(source, "<demo>", "exec")
except SyntaxError as error:
print(traceback.format_exception_only(error)[-1], end="")
try:
{}[[1, 2]] = 3
except TypeError as error:
print("TypeError:", error)
SyntaxError: invalid syntax
SyntaxError: invalid syntax
TypeError: unhashable type: 'list'
Smaller language and library changes
float.from_number()andcomplex.from_number()convert a number to the type, and raiseTypeErrorfor a value that is not a number.14- The format specification accepts
,or_to group the digits after the decimal point, as inf"{x:,.6_f}".14 map()takesstrict=True, aszip()does, to check that all the iterables have the same length.14python -m asyncio ps PIDandpython -m asyncio pstree PIDshow the asyncio tasks of a running process.1- The flag
-X context_aware_warningsmakeswarnings.catch_warningssafe across threads and asyncio tasks. It is on by default in the free-threaded build.1 - The interactive shell highlights Python syntax, and it completes module names after
import.1 See interactive mode.
print(float.from_number(3), complex.from_number(2))
print(f"{1234567.891234:,.6_f}")
try:
list(map(pow, [1, 2, 3], [2, 2], strict=True))
except ValueError as error:
print("ValueError:", error)
3.0 (2+0j)
1,234,567.891_234
ValueError: map() argument 2 is shorter than argument 1
Interpreter, build and release changes
- A new kind of interpreter uses tail calls between small C functions, one for each opcode, in place of one large
switchstatement. Built with Clang 19 or newer on x86-64 or AArch64, it is 3 to 5 percent faster on pyperformance. It is an opt-in build option,--with-tail-call-interp, and it does not change the behaviour of programs.1 - Python 3.14.0 to 3.14.4 shipped an incremental garbage collector. Because of reports of high memory use in production, 3.14.5 went back to the generational collector of 3.13.18 See the cyclic garbage collector.
- The official Windows and macOS binaries include the experimental JIT compiler. It is off by default, and
PYTHON_JIT=1turns it on.1 See the JIT compiler. - PEP 741 adds a C API to read and set the configuration of Python.1
- Emscripten is a tier 3 platform (PEP 776), and python.org provides binary releases for Android.1
- PEP 761: the release managers no longer sign releases with PGP. Use the Sigstore verification material, which releases have had since 3.11.1
Removed and deprecated
Removed in 3.14
Most items below were deprecated in an earlier release.15
- In
ast: the classesNum,Str,Bytes,NameConstantandEllipsis, and the attributesConstant.nandConstant.s. Useast.ConstantandConstant.value. Methods such asvisit_Numon aNodeVisitorare no longer called; definevisit_Constant. - In
asyncio: the child watcher classes and functions, such asget_child_watcher()andThreadedChildWatcher. asyncio.get_event_loop()raisesRuntimeErrorwhen there is no current event loop. It no longer makes a loop. Useasyncio.run()orasyncio.Runner.importlib.abc.ResourceReader,TraversableandTraversableResources. Use the classes inimportlib.resources.abc.- Copy, deep copy and pickle of
itertoolsiterators. pkgutil.get_loader()andpkgutil.find_loader().pty.master_open()andpty.slave_open(). Usepty.openpty().sqlite3.versionandsqlite3.version_info. Usesqlite_versionandsqlite_version_info. A sequence of parameters with named placeholders raisesProgrammingError.urllib.request.URLopenerandFancyURLopener, andurllib.parse.Quoter.- The
isdstparameter ofemail.utils.localtime(). - The
type,choicesandmetavarparameters ofargparse.BooleanOptionalAction. Nested argument groups and nested mutually exclusive groups raiseValueError. - Extra keyword arguments to
pathlib.Path, and extra positional arguments toPurePath.relative_to()andis_relative_to(). int()no longer delegates to__trunc__(). A class must define__int__()or__index__().14NotImplementedin a boolean context raisesTypeError. It gave aDeprecationWarningsince 3.9.14
import ast
import asyncio
print(hasattr(ast, "Num"), hasattr(ast, "Str"))
try:
asyncio.get_event_loop()
except RuntimeError as error:
print("RuntimeError:", error)
False False
RuntimeError: There is no current event loop in thread 'MainThread'.
On 3.12 and 3.13 the same program prints True True and three DeprecationWarning messages.
Deprecated in 3.14
The version in brackets is the planned removal.16
from __future__ import annotations(PEP 563). It is not removed before 3.13 reaches its end of life in 2029.17 See future statements.- The asyncio policy system, such as
asyncio.set_event_loop_policy()andDefaultEventLoopPolicy(3.16). Useasyncio.run()orasyncio.Runnerwithloop_factory. asyncio.iscoroutinefunction()(3.16). Useinspect.iscoroutinefunction().functools.reduce()withfunctionorsequenceas keyword arguments, in the Python implementation (positional-only in 3.16).pathlib.PurePath.as_uri()(3.19). Usepathlib.Path.as_uri().codecs.open(). Useopen().argparse.FileType.- A complex number as the
realorimagargument ofcomplex(). - The module
nturl2path. Useurllib.request.url2pathname()andpathname2url(). - Soft deprecations, with no removal date:
os.popen()and theos.spawn*functions. Usesubprocess.
Migration
Most code that runs on 3.13 without warnings runs on 3.14. These changes can break it.17
- multiprocessing. On Unix platforms other than macOS, the default start method of
multiprocessingandProcessPoolExecutorisforkserver, notfork. Code that relies on a child process inheriting state can fail withNameErroror a pickling error. Windows and macOS still usespawn. - asyncio. Code that calls
asyncio.get_event_loop()outside a running loop to make a loop now fails. Replace therun_until_complete()pattern withasyncio.run().15 - Annotations. Code that reads
__annotations__from the class namespace, or reads class annotations through an instance, can break. Useannotationlib.get_annotations(). - functools.partial. A
partialobject is now a method descriptor, so as a class attribute it bindsself. Wrap it instaticmethod()to keep the old behaviour. - pickle.
pickle.dump()andpickle.dumps()raisePicklingErrorfor some failures that raised other exceptions, such asAttributeError. The original exception is chained. - typing.
types.UnionTypeis now another name fortyping.Union. - re. The pattern
\Bon its own now matches the empty string. - Removed items. Code that uses an item of the list above fails with
ImportError,AttributeErrororRuntimeError. Run the test suite on 3.13 with-W error::DeprecationWarningfirst, to find these uses.
The bugfix release 3.14.5 brings back the generational garbage collector, so gc.get_threshold() and the other gc statistics have their 3.13 meaning again.18 The bugfix release 3.14.10 makes ssl reject certificate chains that contain one of a set of compromised eMudhra intermediate CA certificates (CVE-2026-115557).19 Upgrade from an older 3.14 release to the newest bugfix release.
Support dates
The release manager of 3.14 is Hugo van Kemenade.2 CPython releases have two phases of support.3
| Phase | From | To |
|---|---|---|
| Bugfix (binary installers, regular releases) | 2025-10-07 | about October 2027 |
| Security (source-only releases, as needed) | about October 2027 | October 2030 |
Development of 3.14 began on 2024-05-08. The first alpha came on 2024-10-15, beta 1 on 2025-05-07 and the first release candidate on 2025-07-22.2 PEP 745 plans a bugfix release about every two months, from 3.14.11 on 2026-12-01 to 3.14.16 on 2027-10-05. It marks 3.14.16 as the last regular bugfix release with binary installers.2 After that, security fixes come as source releases until about October 2030.3
The dates of the published releases come from the changelog.20 For 3.14.8 and 3.14.10, PEP 745 gives a date one day later.
| Release | Date |
|---|---|
| 3.14.0 | 2025-10-07 |
| 3.14.1 | 2025-12-02 |
| 3.14.2 | 2025-12-05 |
| 3.14.3 | 2026-02-03 |
| 3.14.4 | 2026-04-07 |
| 3.14.5 | 2026-05-10 |
| 3.14.6 | 2026-06-10 |
| 3.14.7 | 2026-08-05 |
| 3.14.8 | 2026-09-30 |
| 3.14.9 | 2026-10-21 |
| 3.14.10 | 2026-10-25 |
| 3.14.11 (planned) | 2026-12-01 |
References
- What's new in Python 3.14, Summary, release highlights
- PEP 745: Python 3.14 Release Schedule, Release schedule; Bugfix releases; 3.14 lifespan
- Status of Python versions, Python Developer's Guide, Supported versions
- PEP 649: Deferred Evaluation Of Annotations Using Descriptors, Specification
- PEP 749: Implementing PEP 649, Specification
- PEP 750: Template Strings, Specification
- PEP 734: Multiple Interpreters in the Stdlib, Specification
- PEP 758: Allow except and except* expressions without parentheses, Specification
- PEP 765: Disallow return/break/continue that exit a finally block, Specification
- PEP 768: Safe external debugger interface for CPython, Specification; Security implications
- PEP 784: Adding Zstandard to the standard library, Specification
- PEP 779: Criteria for supported status for free-threaded Python, Specification
- What's new in Python 3.14, Improved error messages
- What's new in Python 3.14, Other language changes, Built-ins
- What's new in Python 3.14, Removed
- What's new in Python 3.14, Deprecated, New deprecations
- What's new in Python 3.14, Porting to Python 3.14
- What's new in Python 3.14, Notable changes in 3.14.5
- What's new in Python 3.14, Notable changes in 3.14.10
- Changelog, Python 3.14 documentation, Python 3.14.10 final back to Python 3.14.0 final
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W3 standard |
|
Tag 14S509 Edit this page History Report an error Markdown