From 714204c54941b39f2125f35d9d0e00c21b03fbcd Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:30:59 +0100 Subject: [PATCH] GH-109975: Copyedit 3.13 What's New: Release Highlights (GH-122958) (cherry picked from commit db6f5e193315a3bbfa7b0b6644203bae3f76b638) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- Doc/c-api/module.rst | 2 +- Doc/using/cmdline.rst | 4 +- Doc/using/configure.rst | 2 +- Doc/whatsnew/3.13.rst | 169 +++++++++++++++++++++++++++------------- 4 files changed, 119 insertions(+), 58 deletions(-) diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index 2b68907d1e0fc8..3c779488813383 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -433,7 +433,7 @@ The available slot types are: This slot is ignored by Python builds not configured with :option:`--disable-gil`. Otherwise, it determines whether or not importing this module will cause the GIL to be automatically enabled. See - :ref:`free-threaded-cpython` for more detail. + :ref:`whatsnew313-free-threaded-cpython` for more detail. Multiple ``Py_mod_gil`` slots may not be specified in one module definition. diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index 2d417748c3e81f..7508bf1b60b871 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -618,7 +618,7 @@ Miscellaneous options * :samp:`-X gil={0,1}` forces the GIL to be disabled or enabled, respectively. Only available in builds configured with :option:`--disable-gil`. See also :envvar:`PYTHON_GIL` and - :ref:`free-threaded-cpython`. + :ref:`whatsnew313-free-threaded-cpython`. .. versionadded:: 3.13 @@ -1218,7 +1218,7 @@ conflict. forced on. Setting it to ``0`` forces the GIL off. See also the :option:`-X gil <-X>` command-line option, which takes - precedence over this variable, and :ref:`free-threaded-cpython`. + precedence over this variable, and :ref:`whatsnew313-free-threaded-cpython`. Needs Python configured with the :option:`--disable-gil` build option. diff --git a/Doc/using/configure.rst b/Doc/using/configure.rst index a69343d402eb8d..754191de7bebee 100644 --- a/Doc/using/configure.rst +++ b/Doc/using/configure.rst @@ -299,7 +299,7 @@ General Options Defines the ``Py_GIL_DISABLED`` macro and adds ``"t"`` to :data:`sys.abiflags`. - See :ref:`free-threaded-cpython` for more detail. + See :ref:`whatsnew313-free-threaded-cpython` for more detail. .. versionadded:: 3.13 diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index ecfa5b516b92be..449802938aa77e 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -46,7 +46,7 @@ when researching a change. This article explains the new features in Python 3.13, compared to 3.12. - +Python 3.13 will be released on October 1, 2024. For full details, see the :ref:`changelog `. .. seealso:: @@ -66,14 +66,38 @@ Summary -- Release Highlights .. This section singles out the most important changes in Python 3.13. Brevity is key. -Python 3.13 beta is the pre-release of the next version of the Python -programming language, with a mix of changes to the language, the -implementation and the standard library. The biggest changes to the -implementation include a new interactive interpreter, and experimental -support for dropping the Global Interpreter Lock (:pep:`703`) and a -Just-In-Time compiler (:pep:`744`). The library changes contain removal of -deprecated APIs and modules, as well as the usual improvements in -user-friendliness and correctness. +Python 3.13 will be the latest stable release of the Python programming +language, with a mix of changes to the language, the implementation +and the standard library. +The biggest changes include a new `interactive interpreter +`_, +experimental support for running in a `free-threaded mode +`_ (:pep:`703`), +and a `Just-In-Time compiler `_ (:pep:`744`). + +Error messages continue to improve, with tracebacks now highlighted in color +by default. The :func:`locals` builtin now has :ref:`defined semantics +` for changing the returned mapping, +and type parameters now support default values. + +The library changes contain removal of deprecated APIs and modules, +as well as the usual improvements in user-friendliness and correctness. +Several legacy standard library modules have now `been removed +`_ following their deprecation in Python 3.11 (:pep:`594`). + +This article doesn't attempt to provide a complete specification +of all new features, but instead gives a convenient overview. +For full details refer to the documentation, +such as the :ref:`Library Reference ` +and :ref:`Language Reference `. +To understand the complete implementation and design rationale for a change, +refer to the PEP for a particular new feature; +but note that PEPs usually are not kept up-to-date +once a feature has been fully implemented. +See `Porting to Python 3.13`_ for guidance on upgrading from +earlier versions of Python. + +-------------- .. PEP-sized items next. @@ -82,69 +106,105 @@ Interpreter improvements: * A greatly improved :ref:`interactive interpreter ` and :ref:`improved error messages `. - -* Color support in the new :ref:`interactive interpreter - `, - as well as in :ref:`tracebacks ` - and :ref:`doctest ` output. This can be disabled through the - :envvar:`PYTHON_COLORS` and |NO_COLOR|_ environment variables. - -* :pep:`744`: A basic :ref:`JIT compiler ` was added. - It is currently disabled by default (though we may turn it on later). - Performance improvements are modest -- we expect to be improving this - over the next few releases. - * :pep:`667`: The :func:`locals` builtin now has :ref:`defined semantics ` when mutating the returned mapping. Python debuggers and similar tools may now more reliably update local variables in optimized scopes even during concurrent code execution. +* :pep:`703`: CPython 3.13 has experimental support for running with the + :term:`global interpreter lock` disabled. See :ref:`Free-threaded CPython + ` for more details. +* :pep:`744`: A basic :ref:`JIT compiler ` was added. + It is currently disabled by default (though we may turn it on later). + Performance improvements are modest -- we expect to improve this + over the next few releases. +* Color support in the new :ref:`interactive interpreter + `, + as well as in :ref:`tracebacks ` + and :ref:`doctest ` output. + This can be disabled through the :envvar:`PYTHON_COLORS` and |NO_COLOR|_ + environment variables. -New typing features: +Python data model improvements: -* :pep:`696`: Type parameters (:data:`typing.TypeVar`, :data:`typing.ParamSpec`, - and :data:`typing.TypeVarTuple`) now support defaults. +* :attr:`~class.__static_attributes__` stores the names of attributes accessed + through ``self.X`` in any function in a class body. +* :attr:`!__firstlineno__` records the first line number of a class definition. -* :pep:`702`: Support for marking deprecations in the type system using the - new :func:`warnings.deprecated` decorator. +Significant improvements in the standard library: -* :pep:`742`: :data:`typing.TypeIs` was added, providing more intuitive - type narrowing behavior. +* Add a new :exc:`PythonFinalizationError` exception, raised when an operation + is blocked during :term:`finalization `. +* The :mod:`argparse` module now supports deprecating command-line options, + positional arguments, and subcommands. +* The new functions :func:`base64.z85encode` and :func:`base64.z85decode` + support encoding and decoding `Z85 data `_. +* The :mod:`copy` module now has a :func:`copy.replace` function, + with support for many builtin types and any class defining + the :func:`~object.__replace__` method. +* The :mod:`dbm.sqlite3` module is now the default :mod:`dbm` backend. +* The :mod:`os` module has a suite of new functions for working with Linux's + timer notification file descriptors. +* The :mod:`random` module now has a :ref:`command-line interface `. -* :pep:`705`: :data:`typing.ReadOnly` was added, to mark an item of a - :class:`typing.TypedDict` as read-only for type checkers. +Security improvements: -Free-threading: +* :func:`ssl.create_default_context` sets :data:`ssl.VERIFY_X509_PARTIAL_CHAIN` + and :data:`ssl.VERIFY_X509_STRICT` as default flags. -* :pep:`703`: CPython 3.13 has experimental support for running with the - :term:`global interpreter lock` disabled when built with ``--disable-gil``. - See :ref:`Free-threaded CPython ` for more details. +C API improvements: + +* The :c:data:`Py_mod_gil` slot is now used to indicate that + an extension module supports running with the :term:`GIL` disabled. +* The :doc:`PyTime C API ` has been added, + providing access to system clocks. +* :c:type:`PyMutex` is a new lightweight mutex that occupies a single byte. + +New typing features: + +* :pep:`696`: Type parameters (:data:`typing.TypeVar`, :data:`typing.ParamSpec`, + and :data:`typing.TypeVarTuple`) now support defaults. +* :pep:`702`: The new :func:`warnings.deprecated` decorator adds support + for marking deprecations in the type system. +* :pep:`705`: :data:`typing.ReadOnly` can be used to mark an item of a + :class:`typing.TypedDict` as read-only for type checkers. +* :pep:`742`: :data:`typing.TypeIs` provides more intuitive + type narrowing behavior, as an alternative to :data:`typing.TypeGuard`. Platform support: -* :pep:`730`: Apple's iOS is now an officially supported platform. Official - Android support (:pep:`738`) is in the works as well. +* :pep:`730`: Apple's iOS is now an officially supported platform, + at :pep:`tier 3 <11#tier-3>`. + Official Android support (:pep:`738`) is in the works as well. +* ``wasm32-wasi`` is now a supported as a :pep:`tier 2 <11#tier-2>` platform. +* ``wasm32-emscripten`` is no longer an officially supported platform. -Removed modules: +Important removals: * :ref:`PEP 594 `: The remaining 19 "dead batteries" have been removed from the standard library: :mod:`!aifc`, :mod:`!audioop`, :mod:`!cgi`, :mod:`!cgitb`, :mod:`!chunk`, :mod:`!crypt`, :mod:`!imghdr`, :mod:`!mailcap`, :mod:`!msilib`, :mod:`!nis`, - :mod:`!nntplib`, :mod:`!ossaudiodev`, :mod:`!pipes`, :mod:`!sndhdr`, :mod:`!spwd`, - :mod:`!sunau`, :mod:`!telnetlib`, :mod:`!uu` and :mod:`!xdrlib`. - -* Also removed were the :mod:`!tkinter.tix` and :mod:`!lib2to3` modules, and the - ``2to3`` program. + :mod:`!nntplib`, :mod:`!ossaudiodev`, :mod:`!pipes`, :mod:`!sndhdr`, + :mod:`!spwd`, :mod:`!sunau`, :mod:`!telnetlib`, :mod:`!uu` and :mod:`!xdrlib`. +* Remove the :program:`!2to3` tool and :mod:`!lib2to3` module + (deprecated in Python 3.11). +* Remove the :mod:`!tkinter.tix` module (deprecated in Python 3.6). +* Remove :func:`!locale.resetlocale()`. +* Remove :mod:`!typing.io` and :mod:`!typing.re`. +* Remove chained :class:`classmethod` descriptors. Release schedule changes: -* :pep:`602` ("Annual Release Cycle for Python") has been updated: +:pep:`602` ("Annual Release Cycle for Python") has been updated +to extend the full support ('bugfix') period for new releases to two years. +This updated policy means that: + +* Python 3.9--3.12 have one and a half years of full support, + followed by three and a half years of security fixes. +* Python 3.13 and later have two years of full support, + followed by three years of security fixes. - * Python 3.9 - 3.12 have one and a half years of full support, - followed by three and a half years of security fixes. - * Python 3.13 and later have two years of full support, - followed by three years of security fixes. New Features ============ @@ -253,8 +313,8 @@ Improved Error Messages .. _whatsnew313-locals-semantics: -Defined mutation semantics for ``locals()`` -------------------------------------------- +Defined mutation semantics for :py:func:`locals` +------------------------------------------------ Historically, the expected result of mutating the return value of :func:`locals` has been left to individual Python implementations to define. @@ -322,7 +382,7 @@ Support For Mobile Platforms .. _whatsnew313-jit-compiler: Experimental JIT Compiler -========================= +------------------------- When CPython is configured using the ``--enable-experimental-jit`` option, a just-in-time compiler is added which may speed up some Python programs. @@ -378,10 +438,10 @@ See :pep:`744` for more details. Tier 2 IR by Mark Shannon and Guido van Rossum. Tier 2 optimizer by Ken Jin.) -.. _free-threaded-cpython: +.. _whatsnew313-free-threaded-cpython: Free-threaded CPython -===================== +--------------------- CPython will run with the :term:`global interpreter lock` (GIL) disabled when configured using the ``--disable-gil`` option at build time. This is an @@ -543,7 +603,8 @@ Other Language Changes New Modules =========== -* None. +* :mod:`dbm.sqlite3`: SQLite backend for :mod:`dbm`. + (Contributed by Raymond Hettinger and Erlend E. Aasland in :gh:`100414`.) Improved Modules @@ -664,7 +725,7 @@ base64 * Add :func:`base64.z85encode` and :func:`base64.z85decode` functions which allow encoding and decoding Z85 data. - See `Z85 specification `_ for more information. + See the `Z85 specification `_ for more information. (Contributed by Matan Perelman in :gh:`75299`.) copy pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy