4646   when researching a change. 
4747
4848 This article explains the new features in Python 3.13, compared to 3.12.
49- 
49+ Python 3.13 will be released on October 1, 2024. 
5050For full details, see the :ref: `changelog  <changelog >`.
5151
5252.. seealso ::
@@ -66,14 +66,38 @@ Summary -- Release Highlights
6666..  This section singles out the most important changes in Python 3.13.
6767   Brevity is key. 
6868
69-  Python 3.13 beta is the pre-release of the next version of the Python
70- programming language, with a mix of changes to the language, the
71- implementation and the standard library. The biggest changes to the
72- implementation include a new interactive interpreter, and experimental
73- support for dropping the Global Interpreter Lock (:pep: `703 `) and a
74- Just-In-Time compiler (:pep: `744 `). The library changes contain removal of
75- deprecated APIs and modules, as well as the usual improvements in
76- user-friendliness and correctness.
69+  Python 3.13 will be the latest stable release of the Python programming
70+ language, with a mix of changes to the language, the implementation
71+ and the standard library.
72+ The biggest changes include a new `interactive interpreter 
73+ <whatsnew313-better-interactive-interpreter_> `_,
74+ experimental support for running in a `free-threaded mode 
75+ <whatsnew313-free-threaded-cpython_> `_ (:pep: `703 `),
76+ and a `Just-In-Time compiler  <whatsnew313-jit-compiler _>`_ (:pep: `744 `).
77+ 
78+ Error messages continue to improve, with tracebacks now highlighted in color
79+ by default. The :func: `locals ` builtin now has :ref: `defined semantics 
80+ <whatsnew313-locals-semantics>` for changing the returned mapping,
81+ and type parameters now support default values.
82+ 
83+ The library changes contain removal of deprecated APIs and modules,
84+ as well as the usual improvements in user-friendliness and correctness.
85+ Several legacy standard library modules have now `been removed 
86+ <whatsnew313-pep594_> `_ following their deprecation in Python 3.11 (:pep: `594 `).
87+ 
88+ This article doesn't attempt to provide a complete specification
89+ of all new features, but instead gives a convenient overview.
90+ For full details refer to the documentation,
91+ such as the  :ref: `Library Reference  <library-index >`
92+ and :ref: `Language Reference  <reference-index >`.
93+ To understand the complete implementation and design rationale for a change,
94+ refer to the PEP for a particular new feature;
95+ but note that PEPs usually are not kept up-to-date
96+ once a feature has been fully implemented.
97+ See `Porting to Python 3.13 `_ for guidance on upgrading from
98+ earlier versions of Python.
99+ 
100+ -------------- 
77101
78102..  PEP-sized items next.
79103
@@ -82,69 +106,105 @@ Interpreter improvements:
82106* A greatly improved :ref: `interactive interpreter 
83107  <whatsnew313-better-interactive-interpreter>` and
84108  :ref: `improved error messages  <whatsnew313-improved-error-messages >`.
85- 
86- * Color support in the new :ref: `interactive interpreter 
87-   <whatsnew313-better-interactive-interpreter>`,
88-   as well as in :ref: `tracebacks  <whatsnew313-improved-error-messages >`
89-   and :ref: `doctest  <whatsnew313-doctest >` output. This can be disabled through the
90-   :envvar: `PYTHON_COLORS ` and |NO_COLOR |_ environment variables.
91- 
92- * :pep: `744 `: A basic :ref: `JIT compiler  <whatsnew313-jit-compiler >` was added.
93-   It is currently disabled by default (though we may turn it on later).
94-   Performance improvements are modest -- we expect to be improving this
95-   over the next few releases.
96- 
97109* :pep: `667 `: The :func: `locals ` builtin now has
98110  :ref: `defined semantics  <whatsnew313-locals-semantics >` when mutating the
99111  returned mapping. Python debuggers and similar tools may now more reliably
100112  update local variables in optimized scopes even during concurrent code
101113  execution.
114+ * :pep: `703 `: CPython 3.13 has experimental support for running with the
115+   :term: `global interpreter lock ` disabled. See :ref: `Free-threaded CPython 
116+   <whatsnew313-free-threaded-cpython>` for more details.
117+ * :pep: `744 `: A basic :ref: `JIT compiler  <whatsnew313-jit-compiler >` was added.
118+   It is currently disabled by default (though we may turn it on later).
119+   Performance improvements are modest -- we expect to improve this
120+   over the next few releases.
121+ * Color support in the new :ref: `interactive interpreter 
122+   <whatsnew313-better-interactive-interpreter>`,
123+   as well as in :ref: `tracebacks  <whatsnew313-improved-error-messages >`
124+   and :ref: `doctest  <whatsnew313-doctest >` output.
125+   This can be disabled through the :envvar: `PYTHON_COLORS ` and |NO_COLOR |_
126+   environment variables.
102127
103- New typing features :
128+ Python data model improvements :
104129
105- * :pep: `696 `: Type parameters (:data: `typing.TypeVar `, :data: `typing.ParamSpec `,
106-   and :data: `typing.TypeVarTuple `) now support defaults.
130+ * :attr: `~class.__static_attributes__ ` stores the names of attributes accessed
131+   through ``self.X `` in any function in a class body.
132+ * :attr: `!__firstlineno__ ` records the first line number of a class definition.
107133
108- * :pep: `702 `: Support for marking deprecations in the type system using the
109-   new :func: `warnings.deprecated ` decorator.
134+ Significant improvements in the standard library:
110135
111- * :pep: `742 `: :data: `typing.TypeIs ` was added, providing more intuitive
112-   type narrowing behavior.
136+ * Add a new :exc: `PythonFinalizationError ` exception, raised when an operation
137+   is blocked during :term: `finalization <interpreter shutdown> `.
138+ * The :mod: `argparse ` module now supports deprecating command-line options,
139+   positional arguments, and subcommands.
140+ * The new functions :func: `base64.z85encode ` and :func: `base64.z85decode `
141+   support encoding and decoding `Z85 data  <https://rfc.zeromq.org/spec/32/ >`_.
142+ * The :mod: `copy ` module now has a :func: `copy.replace ` function,
143+   with support for many builtin types and any class defining
144+   the :func: `~object.__replace__ ` method.
145+ * The :mod: `dbm.sqlite3 ` module is now the default :mod: `dbm ` backend.
146+ * The :mod: `os ` module has a suite of new functions for working with Linux's
147+   timer notification file descriptors.
148+ * The :mod: `random ` module now has a :ref: `command-line interface  <random-cli >`.
113149
114- * :pep: `705 `: :data: `typing.ReadOnly ` was added, to mark an item of a
115-   :class: `typing.TypedDict ` as read-only for type checkers.
150+ Security improvements:
116151
117- Free-threading:
152+ * :func: `ssl.create_default_context ` sets :data: `ssl.VERIFY_X509_PARTIAL_CHAIN `
153+   and :data: `ssl.VERIFY_X509_STRICT ` as default flags.
118154
119- * :pep: `703 `: CPython 3.13 has experimental support for running with the
120-   :term: `global interpreter lock ` disabled when built with ``--disable-gil ``.
121-   See :ref: `Free-threaded CPython  <free-threaded-cpython >` for more details.
155+ C API improvements:
156+ 
157+ * The :c:data: `Py_mod_gil ` slot is now used to indicate that
158+   an extension module supports running with the :term: `GIL ` disabled.
159+ * The :doc: `PyTime C API  </c-api/time >` has been added,
160+   providing access to system clocks.
161+ * :c:type: `PyMutex ` is a new lightweight mutex that occupies a single byte.
162+ 
163+ New typing features:
164+ 
165+ * :pep: `696 `: Type parameters (:data: `typing.TypeVar `, :data: `typing.ParamSpec `,
166+   and :data: `typing.TypeVarTuple `) now support defaults.
167+ * :pep: `702 `: The new :func: `warnings.deprecated ` decorator adds support
168+   for marking deprecations in the type system.
169+ * :pep: `705 `: :data: `typing.ReadOnly ` can be used to mark an item of a
170+   :class: `typing.TypedDict ` as read-only for type checkers.
171+ * :pep: `742 `: :data: `typing.TypeIs ` provides more intuitive
172+   type narrowing behavior, as an alternative to :data: `typing.TypeGuard `.
122173
123174Platform support:
124175
125- * :pep: `730 `: Apple's iOS is now an officially supported platform. Official
126-   Android support (:pep: `738 `) is in the works as well.
176+ * :pep: `730 `: Apple's iOS is now an officially supported platform,
177+   at :pep: `tier 3  <11#tier-3 >`.
178+   Official Android support (:pep: `738 `) is in the works as well.
179+ * ``wasm32-wasi `` is now a supported as a :pep: `tier 2  <11#tier-2 >` platform.
180+ * ``wasm32-emscripten `` is no longer an officially supported platform.
127181
128- Removed modules :
182+ Important removals :
129183
130184* :ref: `PEP 594  <whatsnew313-pep594 >`: The remaining 19 "dead batteries"
131185  have been removed from the standard library:
132186  :mod: `!aifc `, :mod: `!audioop `, :mod: `!cgi `, :mod: `!cgitb `, :mod: `!chunk `,
133187  :mod: `!crypt `, :mod: `!imghdr `, :mod: `!mailcap `, :mod: `!msilib `, :mod: `!nis `,
134-   :mod: `!nntplib `, :mod: `!ossaudiodev `, :mod: `!pipes `, :mod: `!sndhdr `, :mod: `!spwd `,
135-   :mod: `!sunau `, :mod: `!telnetlib `, :mod: `!uu ` and :mod: `!xdrlib `.
136- 
137- * Also removed were the :mod: `!tkinter.tix ` and :mod: `!lib2to3 ` modules, and the
138-   ``2to3 `` program.
188+   :mod: `!nntplib `, :mod: `!ossaudiodev `, :mod: `!pipes `, :mod: `!sndhdr `,
189+   :mod: `!spwd `, :mod: `!sunau `, :mod: `!telnetlib `, :mod: `!uu ` and :mod: `!xdrlib `.
190+ * Remove the :program: `!2to3 ` tool and :mod: `!lib2to3 ` module
191+   (deprecated in Python 3.11).
192+ * Remove the :mod: `!tkinter.tix ` module (deprecated in Python 3.6).
193+ * Remove :func: `!locale.resetlocale() `.
194+ * Remove :mod: `!typing.io ` and :mod: `!typing.re `.
195+ * Remove chained :class: `classmethod ` descriptors.
139196
140197Release schedule changes:
141198
142- * :pep: `602 ` ("Annual Release Cycle for Python") has been updated:
199+ :pep: `602 ` ("Annual Release Cycle for Python") has been updated
200+ to extend the full support ('bugfix') period for new releases to two years.
201+ This updated policy means that:
202+ 
203+ * Python 3.9--3.12 have one and a half years of full support,
204+   followed by three and a half years of security fixes.
205+ * Python 3.13 and later have two years of full support,
206+   followed by three years of security fixes.
143207
144-   * Python 3.9 - 3.12 have one and a half years of full support,
145-     followed by three and a half years of security fixes.
146-   * Python 3.13 and later have two years of full support,
147-     followed by three years of security fixes.
148208
149209New Features
150210============ 
@@ -253,8 +313,8 @@ Improved Error Messages
253313
254314.. _whatsnew313-locals-semantics :
255315
256- Defined mutation semantics for `` locals()  ` `
257- ------------------------------------------- 
316+ Defined mutation semantics for :py:func: ` locals `
317+ ------------------------------------------------  
258318
259319Historically, the expected result of mutating the return value of :func: `locals `
260320has been left to individual Python implementations to define.
@@ -322,7 +382,7 @@ Support For Mobile Platforms
322382.. _whatsnew313-jit-compiler :
323383
324384Experimental JIT Compiler
325- ========================= 
385+ ------------------------- 
326386
327387When CPython is configured using the ``--enable-experimental-jit `` option,
328388a just-in-time compiler is added which may speed up some Python programs.
@@ -378,10 +438,10 @@ See :pep:`744` for more details.
378438Tier 2 IR by Mark Shannon and Guido van Rossum.
379439Tier 2 optimizer by Ken Jin.)
380440
381- .. _ free -threaded-cpython :
441+ .. _ whatsnew313-free -threaded-cpython :
382442
383443Free-threaded CPython
384- ===================== 
444+ --------------------- 
385445
386446CPython will run with the :term: `global interpreter lock ` (GIL) disabled when
387447configured using the ``--disable-gil `` option at build time. This is an
@@ -543,7 +603,8 @@ Other Language Changes
543603New Modules
544604=========== 
545605
546- * None.
606+ * :mod: `dbm.sqlite3 `: SQLite backend for :mod: `dbm `.
607+   (Contributed by Raymond Hettinger and Erlend E. Aasland in :gh: `100414 `.)
547608
548609
549610Improved Modules
@@ -664,7 +725,7 @@ base64
664725
665726* Add :func: `base64.z85encode ` and :func: `base64.z85decode ` functions which allow encoding
666727  and decoding Z85 data.
667-   See `Z85   specification  <https://rfc.zeromq.org/spec/32/ >`_ for more information.
728+   See the  `Z85 specification  <https://rfc.zeromq.org/spec/32/ >`_ for more information.
668729  (Contributed by Matan Perelman in :gh: `75299 `.)
669730
670731copy
0 commit comments