1
1
2
2
****************************
3
- What's New In Python 3.14
3
+ What's new in Python 3.14
4
4
****************************
5
5
6
6
:Editor: TBD
@@ -56,7 +56,7 @@ For full details, see the :ref:`changelog <changelog>`.
56
56
so it's worth checking back even after reading earlier versions.
57
57
58
58
59
- Summary -- Release highlights
59
+ Summary -- release highlights
60
60
=============================
61
61
62
62
.. This section singles out the most important changes in Python 3.14.
@@ -67,12 +67,12 @@ Summary -- Release highlights
67
67
68
68
69
69
70
- New Features
70
+ New features
71
71
============
72
72
73
- .. _ whatsnew-314 -pep649 :
73
+ .. _ whatsnew314 -pep649 :
74
74
75
- PEP 649: Deferred Evaluation of Annotations
75
+ PEP 649: deferred evaluation of annotations
76
76
-------------------------------------------
77
77
78
78
The :term: `annotations <annotation> ` on functions, classes, and modules are no
@@ -150,12 +150,12 @@ In Python 3.7, :pep:`563` introduced the ``from __future__ import annotations``
150
150
directive, which turns all annotations into strings. This directive is now
151
151
considered deprecated and it is expected to be removed in a future version of Python.
152
152
However, this removal will not happen until after Python 3.13, the last version of
153
- Python without deferred evaluation of annotations, reaches its end of life.
153
+ Python without deferred evaluation of annotations, reaches its end of life in 2029 .
154
154
In Python 3.14, the behavior of code using ``from __future__ import annotations ``
155
155
is unchanged.
156
156
157
157
158
- Improved Error Messages
158
+ Improved error messages
159
159
-----------------------
160
160
161
161
* When unpacking assignment fails due to incorrect number of variables, the
@@ -172,16 +172,16 @@ Improved Error Messages
172
172
ValueError: too many values to unpack (expected 3, got 4)
173
173
174
174
175
- Other Language Changes
175
+ Other language changes
176
176
======================
177
177
178
178
* Incorrect usage of :keyword: `await ` and asynchronous comprehensions
179
179
is now detected even if the code is optimized away by the :option: `-O `
180
- command line option. For example, ``python -O -c 'assert await 1' ``
180
+ command- line option. For example, ``python -O -c 'assert await 1' ``
181
181
now produces a :exc: `SyntaxError `. (Contributed by Jelle Zijlstra in :gh: `121637 `.)
182
182
183
183
* Writes to ``__debug__ `` are now detected even if the code is optimized
184
- away by the :option: `-O ` command line option. For example,
184
+ away by the :option: `-O ` command- line option. For example,
185
185
``python -O -c 'assert (__debug__ := 1)' `` now produces a
186
186
:exc: `SyntaxError `. (Contributed by Irit Katriel in :gh: `122245 `.)
187
187
@@ -191,15 +191,15 @@ Other Language Changes
191
191
(Contributed by Serhiy Storchaka in :gh: `84978 `.)
192
192
193
193
194
- New Modules
194
+ New modules
195
195
===========
196
196
197
197
* :mod: `annotationlib `: For introspecting :term: `annotations <annotation> `.
198
198
See :pep: `749 ` for more details.
199
199
(Contributed by Jelle Zijlstra in :gh: `119180 `.)
200
200
201
201
202
- Improved Modules
202
+ Improved modules
203
203
================
204
204
205
205
argparse
214
214
---
215
215
216
216
* Add :func: `ast.compare ` for comparing two ASTs.
217
- (Contributed by Batuhan Taskaya and Jeremy Hylton in :issue: ` 15987 `.)
217
+ (Contributed by Batuhan Taskaya and Jeremy Hylton in :gh: ` 60191 `.)
218
218
219
219
* Add support for :func: `copy.replace ` for AST nodes.
220
220
(Contributed by Bénédikt Tran in :gh: `121141 `.)
@@ -246,6 +246,12 @@ decimal
246
246
:meth: `Decimal.from_number() <decimal.Decimal.from_number> `.
247
247
(Contributed by Serhiy Storchaka in :gh: `121798 `.)
248
248
249
+ datetime
250
+ --------
251
+
252
+ * Add :meth: `datetime.time.strptime ` and :meth: `datetime.date.strptime `.
253
+ (Contributed by Wannes Boeykens in :gh: `41431 `.)
254
+
249
255
dis
250
256
---
251
257
254
260
This feature is added to the following interfaces via the *show_positions *
255
261
keyword argument:
256
262
257
- - :class: `dis.Bytecode `,
258
- - :func: `dis.dis `, :func: `dis.distb `, and
259
- - :func: `dis.disassemble `.
263
+ - :class: `dis.Bytecode `
264
+ - :func: `dis.dis `
265
+ - :func: `dis.distb `
266
+ - :func: `dis.disassemble `
260
267
261
268
This feature is also exposed via :option: `dis --show-positions `.
262
269
(Contributed by Bénédikt Tran in :gh: `123165 `.)
310
317
of the error.
311
318
(Contributed by Serhiy Storchaka in :gh: `122163 `.)
312
319
313
- * Enable the :mod: `json ` module to work as a script using the :option: `-m ` switch: ``python -m json ``.
320
+ * Enable the :mod: `json ` module to work as a script using the :option: `-m `
321
+ switch: :program: `python -m json `.
314
322
See the :ref: `JSON command-line interface <json-commandline >` documentation.
315
323
(Contributed by Trey Hunner in :gh: `122873 `.)
316
324
@@ -325,12 +333,6 @@ operator
325
333
(Contributed by Raymond Hettinger and Nico Mexis in :gh: `115808 `.)
326
334
327
335
328
- datetime
329
- --------
330
-
331
- * Add :meth: `datetime.time.strptime ` and :meth: `datetime.date.strptime `.
332
- (Contributed by Wannes Boeykens in :gh: `41431 `.)
333
-
334
336
os
335
337
--
336
338
@@ -357,11 +359,11 @@ pathlib
357
359
pdb
358
360
---
359
361
360
- * Hard-coded breakpoints (:func: `breakpoint ` and :func: `pdb.set_trace `) now
362
+ * Hardcoded breakpoints (:func: `breakpoint ` and :func: `pdb.set_trace `) now
361
363
reuse the most recent :class: `~pdb.Pdb ` instance that calls
362
364
:meth: `~pdb.Pdb.set_trace `, instead of creating a new one each time.
363
365
As a result, all the instance specific data like :pdbcmd: `display ` and
364
- :pdbcmd: `commands ` are preserved across hard-coded breakpoints.
366
+ :pdbcmd: `commands ` are preserved across hardcoded breakpoints.
365
367
(Contributed by Tian Gao in :gh: `121450 `.)
366
368
367
369
* Add a new argument *mode * to :class: `pdb.Pdb `. Disable the ``restart ``
@@ -391,9 +393,9 @@ symtable
391
393
392
394
* Expose the following :class: `symtable.Symbol ` methods:
393
395
394
- * :meth: `~symtable.Symbol.is_free_class `
395
- * :meth: `~symtable.Symbol.is_comp_iter `
396
396
* :meth: `~symtable.Symbol.is_comp_cell `
397
+ * :meth: `~symtable.Symbol.is_comp_iter `
398
+ * :meth: `~symtable.Symbol.is_free_class `
397
399
398
400
(Contributed by Bénédikt Tran in :gh: `120029 `.)
399
401
@@ -472,11 +474,11 @@ ast
472
474
* Remove the following classes. They were all deprecated since Python 3.8,
473
475
and have emitted deprecation warnings since Python 3.12:
474
476
475
- * :class: `!ast.Num `
476
- * :class: `!ast.Str `
477
477
* :class: `!ast.Bytes `
478
- * :class: `!ast.NameConstant `
479
478
* :class: `!ast.Ellipsis `
479
+ * :class: `!ast.NameConstant `
480
+ * :class: `!ast.Num `
481
+ * :class: `!ast.Str `
480
482
481
483
Use :class: `ast.Constant ` instead. As a consequence of these removals,
482
484
user-defined ``visit_Num ``, ``visit_Str ``, ``visit_Bytes ``,
@@ -501,16 +503,16 @@ asyncio
501
503
* Remove the following classes and functions. They were all deprecated and
502
504
emitted deprecation warnings since Python 3.12:
503
505
506
+ * :func: `!asyncio.get_child_watcher `
507
+ * :func: `!asyncio.set_child_watcher `
508
+ * :meth: `!asyncio.AbstractEventLoopPolicy.get_child_watcher `
509
+ * :meth: `!asyncio.AbstractEventLoopPolicy.set_child_watcher `
504
510
* :class: `!asyncio.AbstractChildWatcher `
505
- * :class: `!asyncio.SafeChildWatcher `
506
- * :class: `!asyncio.MultiLoopChildWatcher `
507
511
* :class: `!asyncio.FastChildWatcher `
508
- * :class: `!asyncio.ThreadedChildWatcher `
512
+ * :class: `!asyncio.MultiLoopChildWatcher `
509
513
* :class: `!asyncio.PidfdChildWatcher `
510
- * :meth: `!asyncio.AbstractEventLoopPolicy.get_child_watcher `
511
- * :meth: `!asyncio.AbstractEventLoopPolicy.set_child_watcher `
512
- * :func: `!asyncio.get_child_watcher `
513
- * :func: `!asyncio.set_child_watcher `
514
+ * :class: `!asyncio.SafeChildWatcher `
515
+ * :class: `!asyncio.ThreadedChildWatcher `
514
516
515
517
(Contributed by Kumar Aditya in :gh: `120804 `.)
516
518
@@ -623,14 +625,14 @@ Changes in the Python API
623
625
(Contributed by Serhiy Storchaka in :gh: `69998 `.)
624
626
625
627
626
- Build Changes
628
+ Build changes
627
629
=============
628
630
629
631
630
- C API Changes
632
+ C API changes
631
633
=============
632
634
633
- New Features
635
+ New features
634
636
------------
635
637
636
638
* Add :c:func: `PyLong_GetSign ` function to get the sign of :class: `int ` objects.
@@ -640,17 +642,17 @@ New Features
640
642
object:
641
643
642
644
* :c:func: `PyUnicodeWriter_Create `
645
+ * :c:func: `PyUnicodeWriter_DecodeUTF8Stateful `
643
646
* :c:func: `PyUnicodeWriter_Discard `
644
647
* :c:func: `PyUnicodeWriter_Finish `
648
+ * :c:func: `PyUnicodeWriter_Format `
645
649
* :c:func: `PyUnicodeWriter_WriteChar `
646
- * :c:func: `PyUnicodeWriter_WriteUTF8 `
647
- * :c:func: `PyUnicodeWriter_WriteUCS4 `
648
- * :c:func: `PyUnicodeWriter_WriteWideChar `
649
- * :c:func: `PyUnicodeWriter_WriteStr `
650
650
* :c:func: `PyUnicodeWriter_WriteRepr `
651
+ * :c:func: `PyUnicodeWriter_WriteStr `
651
652
* :c:func: `PyUnicodeWriter_WriteSubstring `
652
- * :c:func: `PyUnicodeWriter_Format `
653
- * :c:func: `PyUnicodeWriter_DecodeUTF8Stateful `
653
+ * :c:func: `PyUnicodeWriter_WriteUCS4 `
654
+ * :c:func: `PyUnicodeWriter_WriteUTF8 `
655
+ * :c:func: `PyUnicodeWriter_WriteWideChar `
654
656
655
657
(Contributed by Victor Stinner in :gh: `119182 `.)
656
658
@@ -671,14 +673,14 @@ New Features
671
673
* Add new functions to convert C ``<stdint.h> `` numbers from/to Python
672
674
:class: `int `:
673
675
674
- * :c:func: `PyLong_FromInt32 `
675
- * :c:func: `PyLong_FromInt64 `
676
- * :c:func: `PyLong_FromUInt32 `
677
- * :c:func: `PyLong_FromUInt64 `
678
676
* :c:func: `PyLong_AsInt32 `
679
677
* :c:func: `PyLong_AsInt64 `
680
678
* :c:func: `PyLong_AsUInt32 `
681
679
* :c:func: `PyLong_AsUInt64 `
680
+ * :c:func: `PyLong_FromInt32 `
681
+ * :c:func: `PyLong_FromInt64 `
682
+ * :c:func: `PyLong_FromUInt32 `
683
+ * :c:func: `PyLong_FromUInt64 `
682
684
683
685
(Contributed by Victor Stinner in :gh: `120389 `.)
684
686
@@ -701,20 +703,20 @@ New Features
701
703
702
704
* Add functions to configure the Python initialization (:pep: `741 `):
703
705
706
+ * :c:func: `Py_InitializeFromInitConfig `
707
+ * :c:func: `PyInitConfig_AddModule `
704
708
* :c:func: `PyInitConfig_Create `
705
709
* :c:func: `PyInitConfig_Free `
710
+ * :c:func: `PyInitConfig_FreeStrList `
706
711
* :c:func: `PyInitConfig_GetError `
707
712
* :c:func: `PyInitConfig_GetExitCode `
708
- * :c:func: `PyInitConfig_HasOption `
709
713
* :c:func: `PyInitConfig_GetInt `
710
714
* :c:func: `PyInitConfig_GetStr `
711
715
* :c:func: `PyInitConfig_GetStrList `
712
- * :c:func: `PyInitConfig_FreeStrList `
716
+ * :c:func: `PyInitConfig_HasOption `
713
717
* :c:func: `PyInitConfig_SetInt `
714
718
* :c:func: `PyInitConfig_SetStr `
715
719
* :c:func: `PyInitConfig_SetStrList `
716
- * :c:func: `PyInitConfig_AddModule `
717
- * :c:func: `Py_InitializeFromInitConfig `
718
720
719
721
(Contributed by Victor Stinner in :gh: `107954 `.)
720
722
0 commit comments