What's new in Python 3.14 — Dokumentasi Python 3.15.2
Navigasi index modul | berikut | sebelum | Python » 3.15.2 documentation » Apa yang Baru di Python » What's new in Python 3.14 | Tema | What's new in Python 3.14 ¶ Editor : Adam Turner and Hugo van Kemenade This article explains the new features in Python 3.14, compared to 3.13. Python 3.14 was released on 7 October 2025. For full details, see the changelog . Lihat juga PEP 745 -- Python 3.14 release schedule Ringkasan -- Sorotan Rilis ¶ Python 3.14 is a stable release of the Python programming language, with a mix of changes to the language, the implementation, and the standard library.
The biggest changes include template string literals , deferred evaluation of annotations , and support for subinterpreters in the standard library. The library changes include significantly improved capabilities for introspection in asyncio , support for Zstandard via a new compression.zstd module, syntax highlighting in the REPL, as well as the usual deprecations and removals, and improvements in user-friendliness and correctness.
This article doesn't attempt to provide a complete specification of all new features, but instead gives a convenient overview. For full details refer to the documentation, such as the Library Reference and Language Reference . To understand the complete implementation and design rationale for a change, refer to the PEP for a particular new feature; but note that PEPs usually are not kept up-to-date once a feature has been fully implemented.
See Porting to Python 3.14 for guidance on upgrading from earlier versions of Python. Peningkatan Interpreter: PEP 649 and PEP 749 : Deferred evaluation of annotations PEP 734 : Multiple interpreters in the standard library PEP 750 : Template strings PEP 758 : Allow except and except* expressions without brackets PEP 765 : Control flow in finally blocks PEP 768 : Safe external debugger interface for CPython A new type of interpreter Free-threaded mode improvements Improved error messages Incremental garbage collection Peningkatan yang signifikan dalam pustaka standar: PEP 784 : Zstandard support in the standard library Asyncio introspection capabilities Concurrent safe warnings control Syntax highlighting in the default interactive shell , and color output in several standard library CLIs Peningkatan API C: PEP 741 : Python configuration C API Platform support: PEP 776 : Emscripten is now an officially supported platform , at tier 3 .
Release changes: PEP 779 : Free-threaded Python is officially supported PEP 761 : PGP signatures have been discontinued for official releases Windows and macOS binary releases now support the experimental just-in-time compiler Binary releases for Android are now provided New features ¶ PEP 649 & PEP 749 : Deferred evaluation of annotations ¶ The annotations on functions, classes, and modules are no longer evaluated eagerly.
Instead, annotations are stored in special-purpose annotate functions and evaluated only when necessary (except if from __future__ import annotations is used). This change is designed to improve performance and usability of annotations in Python in most circumstances. The runtime cost for defining annotations is minimized, but it remains possible to introspect annotations at runtime. It is no longer necessary to enclose annotations in strings if they contain forward references.
The new annotationlib module provides tools for inspecting deferred annotations. Annotations may be evaluated in the VALUE format (which evaluates annotations to runtime values, similar to the behavior in earlier Python versions), the FORWARDREF format (which replaces undefined names with special markers), and the STRING format (which returns annotations as strings). This example shows how these formats behave: >>> from annotationlib import get_annotations , Format >>> def func ( arg : Undefined ): ... pass >>> get_annotations ( func , format = Format .
VALUE ) Traceback (most recent call last): ... NameError : name 'Undefined' is not defined >>> get_annotations ( func , format = Format . FORWARDREF ) {'arg': ForwardRef('Undefined', owner=<function func at 0x...>)} >>> get_annotations ( func , format = Format . STRING ) {'arg': 'Undefined'} The porting section contains guidance on changes that may be needed due to these changes, though in the majority of cases, code will continue working as-is. (Contributed by Jelle Zijlstra in PEP 749 and gh-119180 ; PEP 649 was written by Larry Hastings.) Lihat juga PEP 649 Deferred Evaluation Of Annotations Using Descriptors PEP 749 Implementing PEP 649 PEP 734 : Multiple interpreters in the standard library ¶ The CPython runtime supports running multiple copies of Python in the same process simultaneously and has done so for over 20 years.
Each of these separate copies is called an 'interpreter'. However, the feature had been available only through the C-API . That limitation is removed in Python 3.14, with the new concurrent.interpreters module. There are at least two notable reasons why using multiple interpreters has significant benefits: they support a new (to Python), human-friendly concurrency model true multi-core parallelism For some use cases, concurrency in software improves efficiency and can simplify design, at a high level.
At the same time, implementing and maintaining all but the simplest concurrency is often a struggle for the human brain. That especially applies to plain threads (for example, threading ), where all memory is shared between all threads. With multiple isolated interpreters, you can take advantage of a class of concurrency models, like Communicating Sequential Processes (CSP) or the actor model, that have found success in other programming languages, like Smalltalk, Erlang, Haskell, and Go.
Think of multiple interpreters as threads but with opt-in sharing. Regarding multi-core parallelism: as of Python 3.12, interpreters are now sufficiently isolated from one another to be used in parallel (see PEP 684 ). This unlocks a variety of CPU-intensive use cases for Python that were limited by the GIL . Using multiple interpreters is similar in many ways to multiprocessing , in that they both provide isolated logical "processes" that can run in parallel, with no sharing by default.
However, when using multiple interpreters, an application will use fewer system resources and will operate more efficiently (since it stays within the same process). Think of multiple interpreters as having the isolation of processes with the efficiency of threads. While the feature has been around for decades, multiple interpreters have not been used widely, due to low awareness and the lack of a standard library module.
Consequently, they currently have several notable limitations, which are expected to improve significantly now that the feature is going mainstream. Current limitations: starting each interpreter has not been optimized yet each interpreter uses more memory than necessary (work continues on extensive internal sharing between interpreters) there aren't many options yet for truly sharing objects or other data between interpreters (other than memoryview ) many third-party extension modules on PyPI are not yet compatible with multiple interpreters (all standard library extension modules are compatible) the approach to writing applications that use multiple isolated interpreters is mostly unfamiliar to Python users, for now The impact of these limitations will depend on future CPython improvements, how interpreters are used, and what the community solves through PyPI packages.
Depending on the use case, the limitations may not have much impact, so try it out! Furthermore, future CPython releases will reduce or eliminate overhead and provide utilities that are less appropriate on PyPI. In the meantime, most of the limitations can also be addressed through extension modules, meaning PyPI packages can fill any gap for 3.14, and even back to 3.12 where interpreters were finally properly isolated and stopped sharing the GIL
The rest of this page is on the live site.