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 ` -- 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".
@@ -439,14 +433,14 @@ Defined mutation semantics for :py:func:`locals`
439
433
Historically, the expected result of mutating the return value of
440
434
:func: `locals ` has been left to individual Python implementations to define.
441
435
Starting from Python 3.13, :pep: `667 ` standardises
442
- the historical behaviour of CPython for most code execution scopes,
436
+ the historical behavior of CPython for most code execution scopes,
443
437
but changes :term: `optimized scopes <optimized scope> `
444
438
(functions, generators, coroutines, comprehensions, and generator expressions)
445
439
to explicitly return independent snapshots of the currently assigned local
446
440
variables, including locally referenced nonlocal variables captured in closures.
447
441
448
442
This change to the semantics of :func: `locals ` in optimized scopes also
449
- affects the default behaviour of code execution functions that implicitly
443
+ affects the default behavior of code execution functions that implicitly
450
444
target :func: `!locals ` if no explicit namespace is provided
451
445
(such as :func: `exec ` and :func: `eval `).
452
446
In previous versions, whether or not changes could be accessed by calling
@@ -610,6 +604,9 @@ Other Language Changes
610
604
the value of the *optimize * argument.
611
605
(Contributed by Irit Katriel in :gh: `108113 `).
612
606
607
+ * Add a :attr: `~property.__name__ ` attribute on :class: `property ` objects.
608
+ (Contributed by Eugene Toder in :gh: `101860 `.)
609
+
613
610
* Add :exc: `PythonFinalizationError `, a new exception derived from
614
611
:exc: `RuntimeError ` and used to signal when operations are blocked
615
612
during :term: `finalization <interpreter shutdown> `.
@@ -636,9 +633,6 @@ Other Language Changes
636
633
the :mod: `bz2 `, :mod: `lzma `, :mod: `tarfile `, and :mod: `zipfile ` modules.
637
634
(Contributed by Serhiy Storchaka in :gh: `115961 `.)
638
635
639
- * Add a :attr: `~property.__name__ ` attribute on :class: `property ` objects.
640
- (Contributed by Eugene Toder in :gh: `101860 `.)
641
-
642
636
643
637
New Modules
644
638
===========
678
672
679
673
* The constructors of node types in the :mod: `ast ` module are now
680
674
stricter in the arguments they accept,
681
- with more intuitive behaviour when arguments are omitted.
675
+ with more intuitive behavior when arguments are omitted.
682
676
683
677
If an optional field on an AST node is not included as an argument when
684
678
constructing an instance, the field will now be set to ``None ``. Similarly,
@@ -889,7 +883,7 @@ email
889
883
return ``('', '') `` pairs in more situations where invalid email addresses
890
884
are encountered instead of potentially inaccurate values.
891
885
The two functions have a new optional *strict * parameter (default ``True ``).
892
- To get the old behaviour (accepting malformed input), use ``strict=False ``.
886
+ To get the old behavior (accepting malformed input), use ``strict=False ``.
893
887
``getattr(email.utils, 'supports_strict_parsing', False) `` can be used
894
888
to check if the *strict * parameter is available.
895
889
(Contributed by Thomas Dwyer and Victor Stinner for :gh: `102988 ` to improve
@@ -2055,7 +2049,7 @@ New Features
2055
2049
(Contributed by Victor Stinner and Petr Viktorin in :gh: `110850 `.)
2056
2050
2057
2051
* Add the :c:func: `PyDict_ContainsString ` function
2058
- with the same behaviour as :c:func: `PyDict_Contains `,
2052
+ with the same behavior as :c:func: `PyDict_Contains `,
2059
2053
but *key * is specified as a :c:expr: `const char* ` UTF-8 encoded bytes string,
2060
2054
rather than a :c:expr: `PyObject* `.
2061
2055
(Contributed by Victor Stinner in :gh: `108314 `.)
@@ -2585,7 +2579,7 @@ Changes in the Python API
2585
2579
2586
2580
* Calling :func: `locals ` in an :term: `optimized scope ` now produces an
2587
2581
independent snapshot on each call, and hence no longer implicitly updates
2588
- previously returned references. Obtaining the legacy CPython behaviour now
2582
+ previously returned references. Obtaining the legacy CPython behavior now
2589
2583
requires explicit calls to update the initially returned dictionary with the
2590
2584
results of subsequent calls to :func: `!locals `. Code execution functions that
2591
2585
implicitly target :func: `!locals ` (such as ``exec `` and ``eval ``) must be
0 commit comments