Skip to content
Merged
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
107 changes: 102 additions & 5 deletions Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,48 @@ Summary -- Release highlights
.. This section singles out the most important changes in Python 3.16.
Brevity is key.

* :ref:`Set operations and Unicode properties in regular expressions
<whatsnew316-re-set-operations-and-unicode-properties>`.
* :ref:`Encrypted Client Hello support in ssl <whatsnew316-ssl-ech>`.
* :ref:`Faster interpreter startup <whatsnew316-interpreter-startup>`.
* :ref:`Faster UUID generation <whatsnew316-uuid-optimizations>`, with
UUIDv4 and UUIDv7 about 15 and 30 times faster in microbenchmarks.
* :ref:`Build support for tvOS, watchOS, and visionOS
<whatsnew316-apple-platforms>`.
* :ref:`Improved error messages <whatsnew316-improved-error-messages>`.


New features
============

.. _whatsnew316-improved-error-messages:

Improved error messages
-----------------------

* :exc:`SyntaxError` messages now suggest Python alternatives to some
keywords from other programming languages. For example, ``switch x:``
suggests ``match``, ``delete x`` suggests ``del``, and ``function f():``
suggests ``def``.
(Contributed by Zang Langyan in :gh:`151128`.)

* Improve :exc:`SyntaxError` message for ``&&`` and ``||`` operators,
suggesting ``and``/``&`` and ``or``/``|`` respectively.
(Contributed by Aniket, Sergey B Kirpichev, and Nikita Sobolev in
:gh:`146495`.)

* Suggest the closest valid feature name in the :exc:`SyntaxError` message
when an unknown name is imported from :mod:`__future__`.
(Contributed by Nikita Sobolev and Pablo Galindo Salgado in :gh:`145868`.)

* :exc:`TypeError` messages for some instance methods called with too many
positional arguments now suggest checking whether the method definition is
missing the ``self`` parameter. (Contributed by Suren Nihalani in
:gh:`152315`.)

* Add context notes to :exc:`TypeError` raised while hashing a
:class:`tuple`, identifying the index of the item whose hash failed.
(Contributed by Ivan Zorin in :gh:`161433`.)


Other language changes
Expand Down Expand Up @@ -95,11 +132,6 @@ Other language changes
they reference) alive indefinitely.
(Contributed by Łukasz Langa in :gh:`102960`.)

* :exc:`TypeError` messages for some instance methods called with too many
positional arguments now suggest checking whether the method definition is
missing the ``self`` parameter. (Contributed by Suren Nihalani in
:gh:`152315`.)

* :func:`anext` and :func:`aiter` are now implemented in Python instead
of C. The awaitable returned by ``anext(it, default)`` and the
``__anext__()`` of the iterator returned by ``aiter(callable, ...)`` are
Expand Down Expand Up @@ -204,6 +236,19 @@ concurrent.interpreters
:meth:`~concurrent.interpreters.Interpreter.close`.
(Contributed by Peter Bierma in :gh:`158370`.)


copy
----

* :func:`copy.replace` now supports :class:`argparse.Namespace`,
:class:`optparse.Values`, :class:`decimal.Context`,
:class:`tarfile.TarInfo`, and CSV dialects (instances of
:class:`csv.Dialect` subclasses and objects returned by
:func:`csv.get_dialect`).
(Contributed by Serhiy Storchaka and Stan Ulbrych in :gh:`155043`,
:gh:`155044`, :gh:`155041`, :gh:`155040`, and :gh:`155033`.)


csv
---

Expand Down Expand Up @@ -639,6 +684,8 @@ quopri
re
--

.. _whatsnew316-re-set-operations-and-unicode-properties:

* :mod:`re` now supports set operations and nested sets in character classes,
as described in `Unicode Technical Standard #18
<https://unicode.org/reports/tr18/>`__: set difference (``[A--B]``),
Expand Down Expand Up @@ -709,6 +756,8 @@ sqlite3
ssl
---

.. _whatsnew316-ssl-ech:

* Added support for :ref:`Encrypted Client Hello <ssl-encrypted-client-hello>`
(ECH) with OpenSSL 4.0 or later. Clients can supply an ECHConfigList
discovered through DNS, for example using a third-party library such as
Expand Down Expand Up @@ -1009,6 +1058,35 @@ zlib
Optimizations
=============

.. _whatsnew316-interpreter-startup:

* Interpreter startup is faster, and several common operations have been
optimized. Improvements include less work during garbage collection and
faster construction of :class:`list`, :class:`dict`, :class:`bytes`, and
:class:`bytearray` objects.
Startup performance is tracked on the `Python Speed Center
<https://speed.python.org/timeline/?exe=12&base=&ben=python_startup.legacy&env=1%2C7&revs=50&equid=off&quarts=on&extr=on>`__.
(Contributed by Pablo Galindo Salgado, Cody Maloney, and Pieter Eendebak in
:gh:`159137`, :gh:`160858`, :gh:`160913`, and :gh:`87613`.)

* Speed up iteration over asynchronous generators: values yielded to
``async for`` no longer create and discard a :exc:`StopIteration` exception
at every nesting level. The ``async_generators`` pyperformance benchmark is
about 30% faster.
(Contributed by Shamil Abdulaev in :gh:`158304`.)


ast
---

* AST nodes now store attributes inline with shared keys instead of
allocating a separate dictionary for each node. Benchmarks of this
change measured about 16% faster :func:`ast.parse` calls and 52% less
memory used by the resulting ASTs.
(Contributed by Lysandros Nikolaou and Pablo Galindo Salgado
in :gh:`153568`.)


datetime and time
-----------------

Expand Down Expand Up @@ -1344,6 +1422,25 @@ Build changes

(Contributed by Stan Ulbrych, Florian Mayer and AnnaAr321 in :gh:`156049`.)

* iOS builds can now be configured as free-threaded or debug builds.

(Contributed by Russell Keith-Magee in :gh:`159385`.)


.. _whatsnew316-apple-platforms:

Build support for tvOS, watchOS, and visionOS
---------------------------------------------

Added build support for Apple's tvOS, watchOS, and visionOS.
These platforms are not currently included in the supported
platform tiers defined by :pep:`11`.
See the :source:`tvOS <Platforms/Apple/tvOS/README.md>`,
:source:`watchOS <Platforms/Apple/watchOS/README.md>`, and
:source:`visionOS <Platforms/Apple/visionOS/README.md>` build instructions.

(Contributed by Russell Keith-Magee in :gh:`131999`.)


C API changes
=============
Expand Down
Loading