Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-123299: Copyedit "What's New in Python 3.14" #125438

Merged
merged 6 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/deprecations/c-api-pending-removal-in-3.14.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Pending Removal in Python 3.14
Pending removal in Python 3.14
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules
Expand Down
2 changes: 1 addition & 1 deletion Doc/deprecations/c-api-pending-removal-in-3.15.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Pending Removal in Python 3.15
Pending removal in Python 3.15
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* The bundled copy of ``libmpdecimal``.
Expand Down
2 changes: 1 addition & 1 deletion Doc/deprecations/c-api-pending-removal-in-future.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Pending Removal in Future Versions
Pending removal in future versions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The following APIs are deprecated and will be removed,
Expand Down
2 changes: 1 addition & 1 deletion Doc/deprecations/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Deprecations

.. include:: pending-removal-in-future.rst

C API Deprecations
C API deprecations
------------------

.. include:: c-api-pending-removal-in-3.15.rst
Expand Down
2 changes: 1 addition & 1 deletion Doc/deprecations/pending-removal-in-3.13.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Pending Removal in Python 3.13
Pending removal in Python 3.13
------------------------------

Modules (see :pep:`594`):
Expand Down
2 changes: 1 addition & 1 deletion Doc/deprecations/pending-removal-in-3.14.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Pending Removal in Python 3.14
Pending removal in Python 3.14
------------------------------

* The import system:
Expand Down
4 changes: 2 additions & 2 deletions Doc/deprecations/pending-removal-in-3.15.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Pending Removal in Python 3.15
Pending removal in Python 3.15
------------------------------

* The import system:
Expand Down Expand Up @@ -63,7 +63,7 @@ Pending Removal in Python 3.15

* The undocumented keyword argument syntax for creating
:class:`~typing.NamedTuple` classes
(e.g. ``Point = NamedTuple("Point", x=int, y=int)``)
(for example, ``Point = NamedTuple("Point", x=int, y=int)``)
has been deprecated since Python 3.13.
Use the class-based syntax or the functional syntax instead.

Expand Down
29 changes: 14 additions & 15 deletions Doc/deprecations/pending-removal-in-3.16.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
Pending Removal in Python 3.16
Pending removal in Python 3.16
------------------------------

* :mod:`builtins`:

* Bitwise inversion on boolean types, ``~True`` or ``~False``
has been deprecated since Python 3.12,
as it produces surprising and unintuitive results (``-2`` and ``-1``).
Use ``not x`` instead for the logical negation of a Boolean.
In the rare case that you need the bitwise inversion of
the underlying integer, convert to ``int`` explicitly (``~int(x)``).

* :mod:`array`:

* The ``'u'`` format code (:c:type:`wchar_t`)
Expand All @@ -20,11 +11,19 @@ Pending Removal in Python 3.16

* :mod:`asyncio`:

* :mod:`asyncio`:
:func:`!asyncio.iscoroutinefunction` is deprecated
and will be removed in Python 3.16,
use :func:`inspect.iscoroutinefunction` instead.
(Contributed by Jiahao Li and Kumar Aditya in :gh:`122875`.)
* :func:`!asyncio.iscoroutinefunction` is deprecated
and will be removed in Python 3.16,
use :func:`inspect.iscoroutinefunction` instead.
(Contributed by Jiahao Li and Kumar Aditya in :gh:`122875`.)

* :mod:`builtins`:

* Bitwise inversion on boolean types, ``~True`` or ``~False``
has been deprecated since Python 3.12,
as it produces surprising and unintuitive results (``-2`` and ``-1``).
Use ``not x`` instead for the logical negation of a Boolean.
In the rare case that you need the bitwise inversion of
the underlying integer, convert to ``int`` explicitly (``~int(x)``).

* :mod:`shutil`:

Expand Down
2 changes: 1 addition & 1 deletion Doc/deprecations/pending-removal-in-future.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Pending Removal in Future Versions
Pending removal in future versions
----------------------------------

The following APIs will be removed in the future,
Expand Down
110 changes: 56 additions & 54 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

****************************
What's New In Python 3.14
What's new in Python 3.14
****************************

:Editor: TBD
Expand Down Expand Up @@ -56,7 +56,7 @@ For full details, see the :ref:`changelog <changelog>`.
so it's worth checking back even after reading earlier versions.


Summary -- Release highlights
Summary -- release highlights
=============================

.. This section singles out the most important changes in Python 3.14.
Expand All @@ -67,12 +67,12 @@ Summary -- Release highlights



New Features
New features
============

.. _whatsnew-314-pep649:
.. _whatsnew314-pep649:

PEP 649: Deferred Evaluation of Annotations
PEP 649: deferred evaluation of annotations
-------------------------------------------

The :term:`annotations <annotation>` on functions, classes, and modules are no
Expand Down Expand Up @@ -150,12 +150,12 @@ In Python 3.7, :pep:`563` introduced the ``from __future__ import annotations``
directive, which turns all annotations into strings. This directive is now
considered deprecated and it is expected to be removed in a future version of Python.
However, this removal will not happen until after Python 3.13, the last version of
Python without deferred evaluation of annotations, reaches its end of life.
Python without deferred evaluation of annotations, reaches its end of life in 2029.
In Python 3.14, the behavior of code using ``from __future__ import annotations``
is unchanged.


Improved Error Messages
Improved error messages
-----------------------

* When unpacking assignment fails due to incorrect number of variables, the
Expand All @@ -172,16 +172,16 @@ Improved Error Messages
ValueError: too many values to unpack (expected 3, got 4)


Other Language Changes
Other language changes
======================

* Incorrect usage of :keyword:`await` and asynchronous comprehensions
is now detected even if the code is optimized away by the :option:`-O`
command line option. For example, ``python -O -c 'assert await 1'``
command-line option. For example, ``python -O -c 'assert await 1'``
now produces a :exc:`SyntaxError`. (Contributed by Jelle Zijlstra in :gh:`121637`.)

* Writes to ``__debug__`` are now detected even if the code is optimized
away by the :option:`-O` command line option. For example,
away by the :option:`-O` command-line option. For example,
``python -O -c 'assert (__debug__ := 1)'`` now produces a
:exc:`SyntaxError`. (Contributed by Irit Katriel in :gh:`122245`.)

Expand All @@ -191,15 +191,15 @@ Other Language Changes
(Contributed by Serhiy Storchaka in :gh:`84978`.)


New Modules
New modules
===========

* :mod:`annotationlib`: For introspecting :term:`annotations <annotation>`.
See :pep:`749` for more details.
(Contributed by Jelle Zijlstra in :gh:`119180`.)


Improved Modules
Improved modules
================

argparse
Expand All @@ -214,7 +214,7 @@ ast
---

* Add :func:`ast.compare` for comparing two ASTs.
(Contributed by Batuhan Taskaya and Jeremy Hylton in :issue:`15987`.)
(Contributed by Batuhan Taskaya and Jeremy Hylton in :gh:`60191`.)

* Add support for :func:`copy.replace` for AST nodes.
(Contributed by Bénédikt Tran in :gh:`121141`.)
Expand Down Expand Up @@ -246,6 +246,12 @@ decimal
:meth:`Decimal.from_number() <decimal.Decimal.from_number>`.
(Contributed by Serhiy Storchaka in :gh:`121798`.)

datetime
--------

* Add :meth:`datetime.time.strptime` and :meth:`datetime.date.strptime`.
(Contributed by Wannes Boeykens in :gh:`41431`.)

dis
---

Expand All @@ -254,9 +260,10 @@ dis
This feature is added to the following interfaces via the *show_positions*
keyword argument:

- :class:`dis.Bytecode`,
- :func:`dis.dis`, :func:`dis.distb`, and
- :func:`dis.disassemble`.
- :class:`dis.Bytecode`
- :func:`dis.dis`
- :func:`dis.distb`
- :func:`dis.disassemble`

This feature is also exposed via :option:`dis --show-positions`.
(Contributed by Bénédikt Tran in :gh:`123165`.)
Expand Down Expand Up @@ -310,7 +317,8 @@ json
of the error.
(Contributed by Serhiy Storchaka in :gh:`122163`.)

* Enable the :mod:`json` module to work as a script using the :option:`-m` switch: ``python -m json``.
* Enable the :mod:`json` module to work as a script using the :option:`-m`
switch: :program:`python -m json`.
See the :ref:`JSON command-line interface <json-commandline>` documentation.
(Contributed by Trey Hunner in :gh:`122873`.)

Expand All @@ -325,12 +333,6 @@ operator
(Contributed by Raymond Hettinger and Nico Mexis in :gh:`115808`.)


datetime
--------

* Add :meth:`datetime.time.strptime` and :meth:`datetime.date.strptime`.
(Contributed by Wannes Boeykens in :gh:`41431`.)

os
--

Expand All @@ -357,11 +359,11 @@ pathlib
pdb
---

* Hard-coded breakpoints (:func:`breakpoint` and :func:`pdb.set_trace`) now
* Hardcoded breakpoints (:func:`breakpoint` and :func:`pdb.set_trace`) now
reuse the most recent :class:`~pdb.Pdb` instance that calls
:meth:`~pdb.Pdb.set_trace`, instead of creating a new one each time.
As a result, all the instance specific data like :pdbcmd:`display` and
:pdbcmd:`commands` are preserved across hard-coded breakpoints.
:pdbcmd:`commands` are preserved across hardcoded breakpoints.
(Contributed by Tian Gao in :gh:`121450`.)

* Add a new argument *mode* to :class:`pdb.Pdb`. Disable the ``restart``
Expand Down Expand Up @@ -391,9 +393,9 @@ symtable

* Expose the following :class:`symtable.Symbol` methods:

* :meth:`~symtable.Symbol.is_free_class`
* :meth:`~symtable.Symbol.is_comp_iter`
* :meth:`~symtable.Symbol.is_comp_cell`
* :meth:`~symtable.Symbol.is_comp_iter`
* :meth:`~symtable.Symbol.is_free_class`

(Contributed by Bénédikt Tran in :gh:`120029`.)

Expand Down Expand Up @@ -472,11 +474,11 @@ ast
* Remove the following classes. They were all deprecated since Python 3.8,
and have emitted deprecation warnings since Python 3.12:

* :class:`!ast.Num`
* :class:`!ast.Str`
* :class:`!ast.Bytes`
* :class:`!ast.NameConstant`
* :class:`!ast.Ellipsis`
* :class:`!ast.NameConstant`
* :class:`!ast.Num`
* :class:`!ast.Str`

Use :class:`ast.Constant` instead. As a consequence of these removals,
user-defined ``visit_Num``, ``visit_Str``, ``visit_Bytes``,
Expand All @@ -501,16 +503,16 @@ asyncio
* Remove the following classes and functions. They were all deprecated and
emitted deprecation warnings since Python 3.12:

* :func:`!asyncio.get_child_watcher`
* :func:`!asyncio.set_child_watcher`
* :meth:`!asyncio.AbstractEventLoopPolicy.get_child_watcher`
* :meth:`!asyncio.AbstractEventLoopPolicy.set_child_watcher`
* :class:`!asyncio.AbstractChildWatcher`
* :class:`!asyncio.SafeChildWatcher`
* :class:`!asyncio.MultiLoopChildWatcher`
* :class:`!asyncio.FastChildWatcher`
* :class:`!asyncio.ThreadedChildWatcher`
* :class:`!asyncio.MultiLoopChildWatcher`
* :class:`!asyncio.PidfdChildWatcher`
* :meth:`!asyncio.AbstractEventLoopPolicy.get_child_watcher`
* :meth:`!asyncio.AbstractEventLoopPolicy.set_child_watcher`
* :func:`!asyncio.get_child_watcher`
* :func:`!asyncio.set_child_watcher`
* :class:`!asyncio.SafeChildWatcher`
* :class:`!asyncio.ThreadedChildWatcher`

(Contributed by Kumar Aditya in :gh:`120804`.)

Expand Down Expand Up @@ -623,14 +625,14 @@ Changes in the Python API
(Contributed by Serhiy Storchaka in :gh:`69998`.)


Build Changes
Build changes
=============


C API Changes
C API changes
=============

New Features
New features
------------

* Add :c:func:`PyLong_GetSign` function to get the sign of :class:`int` objects.
Expand All @@ -640,17 +642,17 @@ New Features
object:

* :c:func:`PyUnicodeWriter_Create`
* :c:func:`PyUnicodeWriter_DecodeUTF8Stateful`
* :c:func:`PyUnicodeWriter_Discard`
* :c:func:`PyUnicodeWriter_Finish`
* :c:func:`PyUnicodeWriter_Format`
* :c:func:`PyUnicodeWriter_WriteChar`
* :c:func:`PyUnicodeWriter_WriteUTF8`
* :c:func:`PyUnicodeWriter_WriteUCS4`
* :c:func:`PyUnicodeWriter_WriteWideChar`
* :c:func:`PyUnicodeWriter_WriteStr`
* :c:func:`PyUnicodeWriter_WriteRepr`
* :c:func:`PyUnicodeWriter_WriteStr`
* :c:func:`PyUnicodeWriter_WriteSubstring`
* :c:func:`PyUnicodeWriter_Format`
* :c:func:`PyUnicodeWriter_DecodeUTF8Stateful`
* :c:func:`PyUnicodeWriter_WriteUCS4`
* :c:func:`PyUnicodeWriter_WriteUTF8`
* :c:func:`PyUnicodeWriter_WriteWideChar`

(Contributed by Victor Stinner in :gh:`119182`.)

Expand All @@ -671,14 +673,14 @@ New Features
* Add new functions to convert C ``<stdint.h>`` numbers from/to Python
:class:`int`:

* :c:func:`PyLong_FromInt32`
* :c:func:`PyLong_FromInt64`
* :c:func:`PyLong_FromUInt32`
* :c:func:`PyLong_FromUInt64`
* :c:func:`PyLong_AsInt32`
* :c:func:`PyLong_AsInt64`
* :c:func:`PyLong_AsUInt32`
* :c:func:`PyLong_AsUInt64`
* :c:func:`PyLong_FromInt32`
* :c:func:`PyLong_FromInt64`
* :c:func:`PyLong_FromUInt32`
* :c:func:`PyLong_FromUInt64`

(Contributed by Victor Stinner in :gh:`120389`.)

Expand All @@ -701,20 +703,20 @@ New Features

* Add functions to configure the Python initialization (:pep:`741`):

* :c:func:`Py_InitializeFromInitConfig`
* :c:func:`PyInitConfig_AddModule`
* :c:func:`PyInitConfig_Create`
* :c:func:`PyInitConfig_Free`
* :c:func:`PyInitConfig_FreeStrList`
* :c:func:`PyInitConfig_GetError`
* :c:func:`PyInitConfig_GetExitCode`
* :c:func:`PyInitConfig_HasOption`
* :c:func:`PyInitConfig_GetInt`
* :c:func:`PyInitConfig_GetStr`
* :c:func:`PyInitConfig_GetStrList`
* :c:func:`PyInitConfig_FreeStrList`
* :c:func:`PyInitConfig_HasOption`
* :c:func:`PyInitConfig_SetInt`
* :c:func:`PyInitConfig_SetStr`
* :c:func:`PyInitConfig_SetStrList`
* :c:func:`PyInitConfig_AddModule`
* :c:func:`Py_InitializeFromInitConfig`

(Contributed by Victor Stinner in :gh:`107954`.)

Expand Down
Loading