From f7f25fb9dd1e5cebe28894f02029fdf1898c279a Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Mon, 9 Nov 2026 15:58:41 -0800 Subject: [PATCH 1/5] Docs: Update What's New for Python 3.16 alpha 2 --- Doc/whatsnew/3.16.rst | 94 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 89 insertions(+), 5 deletions(-) diff --git a/Doc/whatsnew/3.16.rst b/Doc/whatsnew/3.16.rst index ce001d07731bcc5..0c995bf219fb24b 100644 --- a/Doc/whatsnew/3.16.rst +++ b/Doc/whatsnew/3.16.rst @@ -62,11 +62,47 @@ 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 + `. +* :ref:`Encrypted Client Hello support in ssl `. +* :ref:`Faster UUID generation `, with + UUIDv4 and UUIDv7 about 15 and 30 times faster in microbenchmarks. +* :ref:`Build support for tvOS, watchOS, and visionOS + `. +* :ref:`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 @@ -95,11 +131,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 @@ -204,6 +235,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 --- @@ -636,6 +680,8 @@ quopri (Contributed by Serhiy Storchaka in :gh:`62222`.) +.. _whatsnew316-re: + re -- @@ -706,6 +752,8 @@ sqlite3 (Contributed by Serhiy Storchaka in :gh:`157470`.) +.. _whatsnew316-ech: + ssl --- @@ -1009,6 +1057,23 @@ zlib Optimizations ============= +* 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 in :gh:`153568`.) + + datetime and time ----------------- @@ -1344,6 +1409,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 `, +:source:`watchOS `, and +:source:`visionOS ` build instructions. + +(Contributed by Russell Keith-Magee in :gh:`131999`.) + C API changes ============= From 83136ade6f949486a099c1566ae30bc0e20743f8 Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Mon, 9 Nov 2026 16:32:51 -0800 Subject: [PATCH 2/5] Docs: Highlight startup and interpreter optimizations in 3.16 --- Doc/whatsnew/3.16.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Doc/whatsnew/3.16.rst b/Doc/whatsnew/3.16.rst index 0c995bf219fb24b..6854c0d9489dca4 100644 --- a/Doc/whatsnew/3.16.rst +++ b/Doc/whatsnew/3.16.rst @@ -65,6 +65,7 @@ Summary -- Release highlights * :ref:`Set operations and Unicode properties in regular expressions `. * :ref:`Encrypted Client Hello support in ssl `. +* :ref:`Faster interpreter startup `. * :ref:`Faster UUID generation `, with UUIDv4 and UUIDv7 about 15 and 30 times faster in microbenchmarks. * :ref:`Build support for tvOS, watchOS, and visionOS @@ -1054,9 +1055,20 @@ zlib .. Add improved modules above alphabetically, not here at the end. +.. _whatsnew316-optimizations: + Optimizations ============= +* 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 + `__. + (Contributed by Pablo Galindo Salgado, Cody Maloney, and Pieter Eendebak in + :gh:`159138`, :gh:`159154`, :gh:`160859`, :gh:`160922`, and :gh:`158891`.) + * 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 From b97e62385eace1d0d5f7055c48d0924d9821f45f Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Tue, 10 Nov 2026 08:24:24 -0800 Subject: [PATCH 3/5] Update Doc/whatsnew/3.16.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- Doc/whatsnew/3.16.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.16.rst b/Doc/whatsnew/3.16.rst index 6854c0d9489dca4..c05c1cbb07ed60e 100644 --- a/Doc/whatsnew/3.16.rst +++ b/Doc/whatsnew/3.16.rst @@ -1083,7 +1083,8 @@ ast 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 in :gh:`153568`.) + (Contributed by Lysandros Nikolaou and Pablo Galindo Salgado + in :gh:`153568`.) datetime and time From 5fc0f6cd6702755d6d1ecd27efda5961f5617ebc Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Tue, 10 Nov 2026 08:25:29 -0800 Subject: [PATCH 4/5] Update Doc/whatsnew/3.16.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- Doc/whatsnew/3.16.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.16.rst b/Doc/whatsnew/3.16.rst index c05c1cbb07ed60e..908bde0e8509dc3 100644 --- a/Doc/whatsnew/3.16.rst +++ b/Doc/whatsnew/3.16.rst @@ -1067,7 +1067,7 @@ Optimizations Startup performance is tracked on the `Python Speed Center `__. (Contributed by Pablo Galindo Salgado, Cody Maloney, and Pieter Eendebak in - :gh:`159138`, :gh:`159154`, :gh:`160859`, :gh:`160922`, and :gh:`158891`.) + :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 From 8587a69ae85abbcd86533ef629ba8d9c336403a8 Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Tue, 10 Nov 2026 08:31:04 -0800 Subject: [PATCH 5/5] Docs: Target 3.16 highlights at specific feature entries --- Doc/whatsnew/3.16.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Doc/whatsnew/3.16.rst b/Doc/whatsnew/3.16.rst index 908bde0e8509dc3..90639f9b1df57d0 100644 --- a/Doc/whatsnew/3.16.rst +++ b/Doc/whatsnew/3.16.rst @@ -63,9 +63,9 @@ Summary -- Release highlights Brevity is key. * :ref:`Set operations and Unicode properties in regular expressions - `. -* :ref:`Encrypted Client Hello support in ssl `. -* :ref:`Faster interpreter startup `. + `. +* :ref:`Encrypted Client Hello support in ssl `. +* :ref:`Faster interpreter startup `. * :ref:`Faster UUID generation `, with UUIDv4 and UUIDv7 about 15 and 30 times faster in microbenchmarks. * :ref:`Build support for tvOS, watchOS, and visionOS @@ -681,11 +681,11 @@ quopri (Contributed by Serhiy Storchaka in :gh:`62222`.) -.. _whatsnew316-re: - 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 `__: set difference (``[A--B]``), @@ -753,11 +753,11 @@ sqlite3 (Contributed by Serhiy Storchaka in :gh:`157470`.) -.. _whatsnew316-ech: - ssl --- +.. _whatsnew316-ssl-ech: + * Added support for :ref:`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 @@ -1055,11 +1055,11 @@ zlib .. Add improved modules above alphabetically, not here at the end. -.. _whatsnew316-optimizations: - 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