gh-109975: Copyedit What's New in Python 3.13 (#123150)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
Jelle Zijlstra 2024-08-19 16:51:37 -07:00 committed by GitHub
parent 833c58b81e
commit 0480052ea1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -499,7 +499,7 @@ by an order of magnitude or more for larger heaps.
Other Language Changes Other Language Changes
====================== ======================
* The compiler now strips common common leading whitespace * The compiler now strips common leading whitespace
from every line in a docstring. from every line in a docstring.
This reduces the size of the :term:`bytecode cache <bytecode>` This reduces the size of the :term:`bytecode cache <bytecode>`
(such as ``.pyc`` files), with reductions in file size of around 5%, (such as ``.pyc`` files), with reductions in file size of around 5%,
@ -632,7 +632,7 @@ array
It can be used instead of ``'u'`` type code, which is deprecated. It can be used instead of ``'u'`` type code, which is deprecated.
(Contributed by Inada Naoki in :gh:`80480`.) (Contributed by Inada Naoki in :gh:`80480`.)
* Add ``clear()`` method in order to implement ``MutableSequence``. * Add ``clear()`` method in order to implement :class:`~collections.abc.MutableSequence`.
(Contributed by Mike Zimin in :gh:`114894`.) (Contributed by Mike Zimin in :gh:`114894`.)
ast ast
@ -904,7 +904,7 @@ importlib
io io
-- --
* The :class:`io.IOBase` finalizer now logs the ``close()`` method errors with * The :class:`io.IOBase` finalizer now logs errors raised by the ``close()`` method with
:data:`sys.unraisablehook`. Previously, errors were ignored silently by default, :data:`sys.unraisablehook`. Previously, errors were ignored silently by default,
and only logged in :ref:`Python Development Mode <devmode>` or on :ref:`Python and only logged in :ref:`Python Development Mode <devmode>` or on :ref:`Python
built on debug mode <debug-build>`. built on debug mode <debug-build>`.
@ -957,7 +957,7 @@ mimetypes
mmap mmap
---- ----
* The :class:`mmap.mmap` class now has an :meth:`~mmap.mmap.seekable` method * The :class:`mmap.mmap` class now has a :meth:`~mmap.mmap.seekable` method
that can be used when a seekable file-like object is required. that can be used when a seekable file-like object is required.
The :meth:`~mmap.mmap.seek` method now returns the new absolute position. The :meth:`~mmap.mmap.seek` method now returns the new absolute position.
(Contributed by Donghee Na and Sylvie Liberman in :gh:`111835`.) (Contributed by Donghee Na and Sylvie Liberman in :gh:`111835`.)
@ -1091,7 +1091,7 @@ pathlib
pdb pdb
--- ---
* Add ability to move between chained exceptions during post mortem debugging in :func:`~pdb.pm` using * Add ability to move between chained exceptions during post-mortem debugging in :func:`~pdb.pm` using
the new ``exceptions [exc_number]`` command for Pdb. (Contributed by Matthias the new ``exceptions [exc_number]`` command for Pdb. (Contributed by Matthias
Bussonnier in :gh:`106676`.) Bussonnier in :gh:`106676`.)
@ -1187,7 +1187,7 @@ subprocess
more situations. Notably in the default case of ``close_fds=True`` on more more situations. Notably in the default case of ``close_fds=True`` on more
recent versions of platforms including Linux, FreeBSD, and Solaris where the recent versions of platforms including Linux, FreeBSD, and Solaris where the
C library provides :c:func:`!posix_spawn_file_actions_addclosefrom_np`. C library provides :c:func:`!posix_spawn_file_actions_addclosefrom_np`.
On Linux this should perform similar to our existing Linux :c:func:`!vfork` On Linux this should perform similarly to the existing Linux :c:func:`!vfork`
based code. A private control knob :attr:`!subprocess._USE_POSIX_SPAWN` can based code. A private control knob :attr:`!subprocess._USE_POSIX_SPAWN` can
be set to ``False`` if you need to force :mod:`subprocess` not to ever use be set to ``False`` if you need to force :mod:`subprocess` not to ever use
:func:`os.posix_spawn`. Please report your reason and platform details in :func:`os.posix_spawn`. Please report your reason and platform details in
@ -1198,7 +1198,7 @@ subprocess
sys sys
--- ---
* Add the :func:`sys._is_interned` function to test if the string was interned. * Add the :func:`sys._is_interned` function to test if a string was interned.
This function is not guaranteed to exist in all implementations of Python. This function is not guaranteed to exist in all implementations of Python.
(Contributed by Serhiy Storchaka in :gh:`78573`.) (Contributed by Serhiy Storchaka in :gh:`78573`.)
@ -1214,7 +1214,7 @@ time
---- ----
* On Windows, :func:`time.monotonic()` now uses the * On Windows, :func:`time.monotonic()` now uses the
``QueryPerformanceCounter()`` clock to have a resolution better than 1 us, ``QueryPerformanceCounter()`` clock to have a resolution better than 1 μs,
instead of the ``GetTickCount64()`` clock which has a resolution of 15.6 ms. instead of the ``GetTickCount64()`` clock which has a resolution of 15.6 ms.
(Contributed by Victor Stinner in :gh:`88494`.) (Contributed by Victor Stinner in :gh:`88494`.)
@ -1245,7 +1245,7 @@ tkinter
* Add new optional keyword-only parameter *return_ints* in * Add new optional keyword-only parameter *return_ints* in
the :meth:`!Text.count` method. the :meth:`!Text.count` method.
Passing ``return_ints=True`` makes it always returning the single count Passing ``return_ints=True`` makes it always return the single count
as an integer instead of a 1-tuple or ``None``. as an integer instead of a 1-tuple or ``None``.
(Contributed by Serhiy Storchaka in :gh:`97928`.) (Contributed by Serhiy Storchaka in :gh:`97928`.)
@ -1288,8 +1288,8 @@ traceback
types types
----- -----
* :class:`~types.SimpleNamespace` constructor now allows specifying initial * The :class:`~types.SimpleNamespace` constructor now allows specifying initial
values of attributes as a positional argument which must be a mapping or values of attributes as a positional argument, which must be a mapping or
an iterable of key-value pairs. an iterable of key-value pairs.
(Contributed by Serhiy Storchaka in :gh:`108191`.) (Contributed by Serhiy Storchaka in :gh:`108191`.)
@ -1715,7 +1715,7 @@ New Deprecations
(Contributed by Erlend E. Aasland in :gh:`107948` and :gh:`108278`.) (Contributed by Erlend E. Aasland in :gh:`107948` and :gh:`108278`.)
* :mod:`sys`: :func:`sys._enablelegacywindowsfsencoding` function. * :mod:`sys`: The :func:`sys._enablelegacywindowsfsencoding` function is deprecated.
Replace it with the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment variable. Replace it with the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment variable.
(Contributed by Inada Naoki in :gh:`73427`.) (Contributed by Inada Naoki in :gh:`73427`.)
@ -1739,8 +1739,8 @@ New Deprecations
deprecated. Passing ``None`` to the 'fields' parameter deprecated. Passing ``None`` to the 'fields' parameter
(``NT = NamedTuple("NT", None)`` or ``TD = TypedDict("TD", None)``) is also (``NT = NamedTuple("NT", None)`` or ``TD = TypedDict("TD", None)``) is also
deprecated. Both will be disallowed in Python 3.15. To create a NamedTuple deprecated. Both will be disallowed in Python 3.15. To create a NamedTuple
class with 0 fields, use ``class NT(NamedTuple): pass`` or class with zero fields, use ``class NT(NamedTuple): pass`` or
``NT = NamedTuple("NT", [])``. To create a TypedDict class with 0 fields, use ``NT = NamedTuple("NT", [])``. To create a TypedDict class with zero fields, use
``class TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})``. ``class TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})``.
(Contributed by Alex Waygood in :gh:`105566` and :gh:`105570`.) (Contributed by Alex Waygood in :gh:`105566` and :gh:`105570`.)
@ -1757,7 +1757,7 @@ New Deprecations
* :ref:`user-defined-funcs`: * :ref:`user-defined-funcs`:
Assignment to a function's :attr:`~function.__code__` attribute where the new code Assignment to a function's :attr:`~function.__code__` attribute where the new code
object's type does not match the function's type, is deprecated. The object's type does not match the function's type is deprecated. The
different types are: plain function, generator, async generator and different types are: plain function, generator, async generator and
coroutine. coroutine.
(Contributed by Irit Katriel in :gh:`81137`.) (Contributed by Irit Katriel in :gh:`81137`.)
@ -1998,7 +1998,7 @@ New Features
(Contributed by Victor Stinner in :gh:`116936`.) (Contributed by Victor Stinner in :gh:`116936`.)
* Add two new functions to the C-API, :c:func:`PyRefTracer_SetTracer` and * Add two new functions to the C-API, :c:func:`PyRefTracer_SetTracer` and
:c:func:`PyRefTracer_GetTracer`, that allows to track object creation and :c:func:`PyRefTracer_GetTracer`, that allow to track object creation and
destruction the same way the :mod:`tracemalloc` module does. (Contributed destruction the same way the :mod:`tracemalloc` module does. (Contributed
by Pablo Galindo in :gh:`93502`.) by Pablo Galindo in :gh:`93502`.)