3
3
What's New In Python 3.13
4
4
****************************
5
5
6
- :Editor: Thomas Wouters
6
+ :Editors: Adam Turner and Thomas Wouters
7
7
8
8
.. Rules for maintenance:
9
9
@@ -53,12 +53,6 @@ For full details, see the :ref:`changelog <changelog>`.
53
53
54
54
:pep: `719
10000
` -- Python 3.13 Release Schedule
55
55
56
- .. note ::
57
-
58
- Prerelease users should be aware that this document is currently in draft
59
- form. It will be updated substantially as Python 3.13 moves towards release,
60
- so it's worth checking back even after reading earlier versions.
61
-
62
56
63
57
Summary -- Release Highlights
64
58
=============================
@@ -142,7 +136,7 @@ Significant improvements in the standard library:
142
136
* The :mod: `copy ` module now has a :func: `copy.replace ` function,
143
137
with support for many builtin types and any class defining
144
138
the :func: `~object.__replace__ ` method.
145
- * The :mod: `dbm.sqlite3 ` module is now the default :mod: `dbm ` backend.
139
+ * The new :mod: `dbm.sqlite3 ` module is now the default :mod: `dbm ` backend.
146
140
* The :mod: `os ` module has a :ref: `suite of new functions <os-timerfd >`
147
141
for working with Linux's timer notification file descriptors.
148
142
* The :mod: `random ` module now has a :ref: `command-line interface <random-cli >`.
@@ -167,7 +161,7 @@ New typing features:
167
161
* :pep: `696 `: Type parameters (:data: `typing.TypeVar `, :data: `typing.ParamSpec `,
168
162
and :data: `typing.TypeVarTuple `) now support defaults.
169
163
* :pep: `702 `: The new :func: `warnings.deprecated ` decorator adds support
170
- for marking deprecations in the type system.
164
+ for marking deprecations in the type system and at runtime .
171
165
* :pep: `705 `: :data: `typing.ReadOnly ` can be used to mark an item of a
172
166
:class: `typing.TypedDict ` as read-only for type checkers.
173
167
* :pep: `742 `: :data: `typing.TypeIs ` provides more intuitive
@@ -177,23 +171,23 @@ Platform support:
177
171
178
172
* :pep: `730 `: Apple's iOS is now an :ref: `officially supported platform
179
173
<whatsnew313-platform-support>`, at :pep: `tier 3 <11#tier-3 >`.
180
- Official Android support (:pep: `738 `) is in the works as well .
174
+ Official Android support (:pep: `738 `) is also in the works.
181
175
* ``wasm32-wasi `` is now supported as a :pep: `tier 2 <11#tier-2 >` platform.
182
176
* ``wasm32-emscripten `` is no longer an officially supported platform.
183
177
184
178
Important removals:
185
179
186
180
* :ref: `PEP 594 <whatsnew313-pep594 >`: The remaining 19 "dead batteries"
187
- have been removed from the standard library:
181
+ (legacy stdlib modules) have been removed from the standard library:
188
182
:mod: `!aifc `, :mod: `!audioop `, :mod: `!cgi `, :mod: `!cgitb `, :mod: `!chunk `,
189
183
:mod: `!crypt `, :mod: `!imghdr `, :mod: `!mailcap `, :mod: `!msilib `, :mod: `!nis `,
190
184
:mod: `!nntplib `, :mod: `!ossaudiodev `, :mod: `!pipes `, :mod: `!sndhdr `,
191
185
:mod: `!spwd `, :mod: `!sunau `, :mod: `!telnetlib `, :mod: `!uu ` and :mod: `!xdrlib `.
192
186
* Remove the :program: `2to3 ` tool and :mod: `!lib2to3 ` module
193
187
(deprecated in Python 3.11).
194
188
* Remove the :mod: `!tkinter.tix ` module (deprecated in Python 3.6).
195
- * Remove :func: `!locale.resetlocale `.
196
- * Remove :mod: `!typing.io ` and :mod: `!typing.re `.
189
+ * Remove the :func: `!locale.resetlocale ` function .
190
+ * Remove the :mod: `!typing.io ` and :mod: `!typing.re ` namespaces .
197
191
* Remove chained :class: `classmethod ` descriptors.
198
192
199
193
Release schedule changes:
@@ -338,7 +332,7 @@ designed with threading in mind will run faster on multi-core hardware.
338
332
expect some bugs and a substantial single-threaded performance hit.
339
333
Free-threaded builds of CPython support optionally running with the GIL
340
334
enabled at runtime using the environment variable :envvar: `PYTHON_GIL ` or
341
- the command-line option :option: `-X gil `.
335
+ the command-line option :option: `-X gil=1 `.
342
336
343
337
To check if the current interpreter supports free-threading, :option: `python -VV <-V> `
344
338
and :attr: `sys.version ` contain "experimental free-threading build".
@@ -429,14 +423,14 @@ Defined mutation semantics for :py:func:`locals`
429
423
Historically, the expected result of mutating the return value of
430
424
:func: `locals ` has been left to individual Python implementations to define.
431
425
Starting from Python 3.13, :pep: `667 ` standardises
432
- the historical behaviour of CPython for most code execution scopes,
426
+ the historical behavior of CPython for most code execution scopes,
433
427
but changes :term: `optimized scopes <optimized scope> `
434
428
(functions, generators, coroutines, comprehensions, and generator expressions)
435
429
to explicitly return independent snapshots of the currently assigned local
436
430
variables, including locally referenced nonlocal variables captured in closures.
437
431
438
432
This change to the semantics of :func: `locals ` in optimized scopes also
439
- affects the default behaviour of code execution functions that implicitly
433
+ affects the default behavior of code execution functions that implicitly
440
434
target :func: `!locals ` if no explicit namespace is provided
441
435
(such as :func: `exec ` and :func: `eval `).
442
436
In previous versions, whether or not changes could be accessed by calling
@@ -600,6 +594,9 @@ Other Language Changes
600
594
the value of the *optimize * argument.
601
595
(Contributed by Irit Katriel in :gh: `108113 `).
602
596
597
+ * Add a :attr: `~property.__name__ ` attribute on :class: `property ` objects.
598
+ (Contributed by Eugene Toder in :gh: `101860 `.)
599
+
603
600
* Add :exc: `PythonFinalizationError `, a new exception derived from
604
601
:exc: `RuntimeError ` and used to signal when operations are blocked
605
602
during :term: `finalization <interpreter shutdown> `.
@@ -626,9 +623,6 @@ Other Language Changes
626
623
the :mod: `bz2 `, :mod: `lzma `, :mod: `tarfile `, and :mod: `zipfile ` modules.
627
624
(Contributed by Serhiy Storchaka in :gh: `115961 `.)
628
625
629
- * Add a :attr: `~property.__name__ ` attribute on :class: `property ` objects.
630
- (Contributed by Eugene Toder in :gh: `101860 `.)
631
-
632
626
633
627
New Modules
634
628
===========
668
662
669
663
* The constructors of node types in the :mod: `ast ` module are now
670
664
stricter in the arguments they accept,
671
- with more intuitive behaviour when arguments are omitted.
665
+ with more intuitive behavior when arguments are omitted.
672
666
673
667
If an optional field on an AST node is not included as an argument when
674
668
constructing an instance, the field will now be set to ``None ``. Similarly,
@@ -887,7 +881,7 @@ email
887
881
return ``('', '') `` pairs in more situations where invalid email addresses
888
882
are encountered instead of potentially inaccurate values.
889
883
The two functions have a new optional *strict * parameter (default ``True ``).
890
- To get the old behaviour (accepting malformed input), use ``strict=False ``.
884
+ To get the old behavior (accepting malformed input), use ``strict=False ``.
891
885
``getattr(email.utils, 'supports_strict_parsing', False) `` can be used
892
886
to check if the *strict * parameter is available.
893
887
(Contributed by Thomas Dwyer and Victor Stinner for :gh: `102988 ` to improve
@@ -2053,7 +2047,7 @@ New Features
2053
2047
(Contributed by Victor Stinner and Petr Viktorin in :gh: `110850 `.)
2054
2048
2055
2049
* Add the :c:func: `PyDict_ContainsString ` function
2056
- with the same behaviour as :c:func: `PyDict_Contains `,
2050
+ with the same behavior as :c:func: `PyDict_Contains `,
2057
2051
but *key * is specified as a :c:expr: `const char* ` UTF-8 encoded bytes string,
2058
2052
rather than a :c:expr: `PyObject* `.
2059
2053
(Contributed by Victor Stinner in :gh: `108314 `.)
@@ -2573,7 +2567,7 @@ Changes in the Python API
2573
2567
2574
2568
* Calling :func: `locals ` in an :term: `optimized scope ` now produces an
2575
2569
independent snapshot on each call, and hence no longer implicitly updates
2576
- previously returned references. Obtaining the legacy CPython behaviour now
2570
+ previously returned references. Obtaining the legacy CPython behavior now
2577
2571
requires explicit calls to update the initially returned dictionary with the
2578
2572
results of subsequent calls to :func: `!locals `. Code execution functions that
2579
2573
implicitly target :func: `!locals ` (such as ``exec `` and ``eval ``) must be
0 commit comments