diff --git a/Doc/whatsnew/3.16.rst b/Doc/whatsnew/3.16.rst index ce001d07731bcc5..90639f9b1df57d0 100644 --- a/Doc/whatsnew/3.16.rst +++ b/Doc/whatsnew/3.16.rst @@ -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 + `. +* :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 + `. +* :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 +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 @@ -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 --- @@ -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 `__: set difference (``[A--B]``), @@ -709,6 +756,8 @@ sqlite3 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 @@ -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 + `__. + (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 ----------------- @@ -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 `, +:source:`watchOS `, and +:source:`visionOS ` build instructions. + +(Contributed by Russell Keith-Magee in :gh:`131999`.) + C API changes =============