summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/whatsnew/3.13.rst1051
1 files changed, 542 insertions, 509 deletions
diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst
index daa8cf1..69264a3 100644
--- a/Doc/whatsnew/3.13.rst
+++ b/Doc/whatsnew/3.13.rst
@@ -3,7 +3,7 @@
What's New In Python 3.13
****************************
-:Editor: TBD
+:Editor: Thomas Wouters
.. Rules for maintenance:
@@ -49,6 +49,10 @@ This article explains the new features in Python 3.13, compared to 3.12.
For full details, see the :ref:`changelog <changelog>`.
+.. seealso::
+
+ :pep:`719` -- Python 3.13 Release Schedule
+
.. note::
Prerelease users should be aware that this document is currently in draft
@@ -56,31 +60,34 @@ For full details, see the :ref:`changelog <changelog>`.
so it's worth checking back even after reading earlier versions.
-Summary -- Release highlights
+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.
+
.. PEP-sized items next.
-Important deprecations, removals or restrictions:
+Interpreter improvements:
-* :ref:`PEP 594 <whatsnew313-pep594>`: 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`.
+* A greatly improved :ref:`interactive interpreter
+ <whatsnew313-better-interactive-interpreter>` and
+ :ref:`improved error messages <whatsnew313-improved-error-messages>`.
-* :pep:`602` ("Annual Release Cycle for Python") has been updated:
-
- * 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.
-
-Interpreter improvements:
+* Color support in the new :ref:`interactive interpreter
+ <whatsnew313-better-interactive-interpreter>`,
+ as well as in :ref:`tracebacks <whatsnew313-improved-error-messages>`
+ and :ref:`doctest <whatsnew313-doctest>` output. This can be disabled through the
+ :envvar:`PYTHON_COLORS` and |NO_COLOR|_ environment variables.
* :pep:`744`: A basic :ref:`JIT compiler <whatsnew313-jit-compiler>` was added.
It is currently disabled by default (though we may turn it on later).
@@ -96,37 +103,69 @@ New typing features:
* :pep:`696`: Type parameters (:data:`typing.TypeVar`, :data:`typing.ParamSpec`,
and :data:`typing.TypeVarTuple`) now support defaults.
+
* :pep:`742`: :data:`typing.TypeIs` was added, providing more intuitive
type narrowing behavior.
+* :pep:`705`: :data:`typing.ReadOnly` was added, to mark an item of a
+ :class:`typing.TypedDict` as read-only for type checkers.
+
Free-threading:
* :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 <free-threaded-cpython>` for more details.
+Platform support:
+
+* :pep:`730`: Apple's iOS is now an officially supported platform. Official
+ Android support (:pep:`738`) is in the works as well.
+
+Removed modules:
+
+* :ref:`PEP 594 <whatsnew313-pep594>`: 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.
+
+Release schedule changes:
+
+* :pep:`602` ("Annual Release Cycle for Python") has been updated:
+
+ * 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
============
+.. _whatsnew313-better-interactive-interpreter:
+
A Better Interactive Interpreter
--------------------------------
On Unix-like systems like Linux or macOS, Python now uses a new
-:term:`interactive` shell. When the user starts the :term:`REPL`
-from a tty, and both :mod:`curses` and :mod:`readline` are available,
-the interactive shell now supports the following new features:
-
-* colorized prompts;
-* multiline editing with history preservation;
-* interactive help browsing using :kbd:`F1` with a separate command
- history;
-* history browsing using :kbd:`F2` that skips output as well as the
- :term:`>>>` and :term:`...` prompts;
-* "paste mode" with :kbd:`F3` that makes pasting larger blocks of code
- easier (press :kbd:`F3` again to return to the regular prompt);
-* ability to issue REPL-specific commands like :kbd:`help`, :kbd:`exit`,
- and :kbd:`quit` without the need to use call parentheses after the
- command name.
+:term:`interactive` shell. When the user starts the :term:`REPL` from an
+interactive terminal, and both :mod:`curses` and :mod:`readline` are
+available, the interactive shell now supports the following new features:
+
+* Colorized prompts.
+* Multiline editing with history preservation.
+* Interactive help browsing using :kbd:`F1` with a separate command
+ history.
+* History browsing using :kbd:`F2` that skips output as well as the
+ :term:`>>>` and :term:`...` prompts.
+* "Paste mode" with :kbd:`F3` that makes pasting larger blocks of code
+ easier (press :kbd:`F3` again to return to the regular prompt).
+* The ability to issue REPL-specific commands like :kbd:`help`, :kbd:`exit`,
+ and :kbd:`quit` without the need to use call parentheses after the command
+ name.
If the new interactive shell is not desired, it can be disabled via
the :envvar:`PYTHON_BASIC_REPL` environment variable.
@@ -136,6 +175,8 @@ For more on interactive mode, see :ref:`tut-interac`.
(Contributed by Pablo Galindo Salgado, Ɓukasz Langa, and
Lysandros Nikolaou in :gh:`111201` based on code from the PyPy project.)
+.. _whatsnew313-improved-error-messages:
+
Improved Error Messages
-----------------------
@@ -227,6 +268,105 @@ Support For Mobile Platforms
(PEP written and implementation contributed by Russell Keith-Magee in
:gh:`114099`.)
+.. _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.
+
+The internal architecture is roughly as follows.
+
+* We start with specialized *Tier 1 bytecode*.
+ See :ref:`What's new in 3.11 <whatsnew311-pep659>` for details.
+
+* When the Tier 1 bytecode gets hot enough, it gets translated
+ to a new, purely internal *Tier 2 IR*, a.k.a. micro-ops ("uops").
+
+* The Tier 2 IR uses the same stack-based VM as Tier 1, but the
+ instruction format is better suited to translation to machine code.
+
+* We have several optimization passes for Tier 2 IR, which are applied
+ before it is interpreted or translated to machine code.
+
+* There is a Tier 2 interpreter, but it is mostly intended for debugging
+ the earlier stages of the optimization pipeline.
+ The Tier 2 interpreter can be enabled by configuring Python
+ with ``--enable-experimental-jit=interpreter``.
+
+* When the JIT is enabled, the optimized
+ Tier 2 IR is translated to machine code, which is then executed.
+
+* The machine code translation process uses a technique called
+ *copy-and-patch*. It has no runtime dependencies, but there is a new
+ build-time dependency on LLVM.
+
+The ``--enable-experimental-jit`` flag has the following optional values:
+
+* ``no`` (default) -- Disable the entire Tier 2 and JIT pipeline.
+
+* ``yes`` (default if the flag is present without optional value)
+ -- Enable the JIT. To disable the JIT at runtime,
+ pass the environment variable ``PYTHON_JIT=0``.
+
+* ``yes-off`` -- Build the JIT but disable it by default.
+ To enable the JIT at runtime, pass the environment variable
+ ``PYTHON_JIT=1``.
+
+* ``interpreter`` -- Enable the Tier 2 interpreter but disable the JIT.
+ The interpreter can be disabled by running with
+ ``PYTHON_JIT=0``.
+
+(On Windows, use ``PCbuild/build.bat --experimental-jit`` to enable the JIT
+or ``--experimental-jit-interpreter`` to enable the Tier 2 interpreter.)
+
+See :pep:`744` for more details.
+
+(JIT by Brandt Bucher, inspired by a paper by Haoran Xu and Fredrik Kjolstad.
+Tier 2 IR by Mark Shannon and Guido van Rossum.
+Tier 2 optimizer by Ken Jin.)
+
+.. _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
+experimental feature and therefore isn't used by default. Users need to
+either compile their own interpreter, or install one of the experimental
+builds that are marked as *free-threaded*.
+
+Free-threaded execution allows for full utilization of the available
+processing power by running threads in parallel on available CPU cores.
+While not all software will benefit from this automatically, programs
+designed with threading in mind will run faster on multicore hardware.
+
+Work is still ongoing: expect some bugs and a substantial single-threaded
+performance hit.
+
+The free-threaded build still supports optionally running with the GIL
+enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or
+the command line option :option:`-X gil`.
+
+To check if the current interpreter is configured with ``--disable-gil``,
+use ``sysconfig.get_config_var("Py_GIL_DISABLED")``. To check if the :term:`GIL`
+is actually disabled in the running process, the :func:`!sys._is_gil_enabled`
+function can be used.
+
+C-API extension modules need to be built specifically for the free-threaded
+build. Extensions that support running with the :term:`GIL` disabled should
+use the :c:data:`Py_mod_gil` slot. Extensions using single-phase init should
+use :c:func:`PyUnstable_Module_SetGIL` to indicate whether they support
+running with the GIL disabled. Importing C extensions that don't use these
+mechanisms will cause the GIL to be enabled, unless the GIL was explicitly
+disabled with the :envvar:`PYTHON_GIL` environment variable or the
+:option:`-X gil=0` option.
+
+pip 24.1b1 or newer is required to install packages with C extensions in the
+free-threaded build.
+
Other Language Changes
======================
@@ -500,20 +640,22 @@ dis
the ``show_offsets`` parameter.
(Contributed by Irit Katriel in :gh:`112137`.)
+.. _whatsnew313-doctest:
+
doctest
-------
-* The :meth:`doctest.DocTestRunner.run` method now counts the number of skipped
- tests. Add :attr:`doctest.DocTestRunner.skips` and
- :attr:`doctest.TestResults.skipped` attributes.
- (Contributed by Victor Stinner in :gh:`108794`.)
-
* Color is added to the output by default.
This can be controlled via the new :envvar:`PYTHON_COLORS` environment
variable as well as the canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment
variables. See also :ref:`using-on-controlling-color`.
(Contributed by Hugo van Kemenade in :gh:`117225`.)
+* The :meth:`doctest.DocTestRunner.run` method now counts the number of skipped
+ tests. Add :attr:`doctest.DocTestRunner.skips` and
+ :attr:`doctest.TestResults.skipped` attributes.
+ (Contributed by Victor Stinner in :gh:`108794`.)
+
email
-----
@@ -1008,109 +1150,245 @@ Optimizations
(Contributed by Alex Waygood, Shantanu Jain, Adam Turner, Daniel Hollas and
others in :gh:`109653`.)
-.. _whatsnew313-jit-compiler:
+Removed Modules And APIs
+========================
-Experimental JIT Compiler
-=========================
+.. _whatsnew313-pep594:
-When CPython is configured using the ``--enable-experimental-jit`` option,
-a just-in-time compiler is added which may speed up some Python programs.
+PEP 594: dead batteries (and other module removals)
+---------------------------------------------------
-The internal architecture is roughly as follows.
+* :pep:`594` removed 19 modules from the standard library,
+ deprecated in Python 3.11:
-* We start with specialized *Tier 1 bytecode*.
- See :ref:`What's new in 3.11 <whatsnew311-pep659>` for details.
+ * :mod:`!aifc`.
+ (Contributed by Victor Stinner in :gh:`104773`.)
-* When the Tier 1 bytecode gets hot enough, it gets translated
- to a new, purely internal *Tier 2 IR*, a.k.a. micro-ops ("uops").
+ * :mod:`!audioop`.
+ (Contributed by Victor Stinner in :gh:`104773`.)
-* The Tier 2 IR uses the same stack-based VM as Tier 1, but the
- instruction format is better suited to translation to machine code.
+ * :mod:`!chunk`.
+ (Contributed by Victor Stinner in :gh:`104773`.)
-* We have several optimization passes for Tier 2 IR, which are applied
- before it is interpreted or translated to machine code.
+ * :mod:`!cgi` and :mod:`!cgitb`.
-* There is a Tier 2 interpreter, but it is mostly intended for debugging
- the earlier stages of the optimization pipeline.
- The Tier 2 interpreter can be enabled by configuring Python
- with ``--enable-experimental-jit=interpreter``.
+ * ``cgi.FieldStorage`` can typically be replaced with
+ :func:`urllib.parse.parse_qsl` for ``GET`` and ``HEAD`` requests,
+ and the :mod:`email.message` module or :pypi:`multipart`
+ PyPI project for ``POST`` and ``PUT``.
-* When the JIT is enabled, the optimized
- Tier 2 IR is translated to machine code, which is then executed.
+ * ``cgi.parse()`` can be replaced by calling :func:`urllib.parse.parse_qs`
+ directly on the desired query string, except for ``multipart/form-data``
+ input, which can be handled as described for ``cgi.parse_multipart()``.
-* The machine code translation process uses an architecture called
- *copy-and-patch*. It has no runtime dependencies, but there is a new
- build-time dependency on LLVM.
+ * ``cgi.parse_header()`` can be replaced with the functionality in the
+ :mod:`email` package, which implements the same MIME RFCs. For example,
+ with :class:`email.message.EmailMessage`::
-The ``--enable-experimental-jit`` flag has the following optional values:
+ from email.message import EmailMessage
+ msg = EmailMessage()
+ msg['content-type'] = 'application/json; charset="utf8"'
+ main, params = msg.get_content_type(), msg['content-type'].params
-* ``no`` (default) -- Disable the entire Tier 2 and JIT pipeline.
+ * ``cgi.parse_multipart()`` can be replaced with the functionality in the
+ :mod:`email` package (e.g. :class:`email.message.EmailMessage` and
+ :class:`email.message.Message`) which implements the same MIME RFCs, or
+ with the :pypi:`multipart` PyPI project.
-* ``yes`` (default if the flag is present without optional value)
- -- Enable the JIT. To disable the JIT at runtime,
- pass the environment variable ``PYTHON_JIT=0``.
+ (Contributed by Victor Stinner in :gh:`104773`.)
-* ``yes-off`` -- Build the JIT but disable it by default.
- To enable the JIT at runtime, pass the environment variable
- ``PYTHON_JIT=1``.
+ * :mod:`!crypt` module and its private :mod:`!_crypt` extension.
+ The :mod:`hashlib` module is a potential replacement for certain use cases.
+ Otherwise, the following PyPI projects can be used:
-* ``interpreter`` -- Enable the Tier 2 interpreter but disable the JIT.
- The interpreter can be disabled by running with
- ``PYTHON_JIT=0``.
+ * :pypi:`bcrypt`:
+ Modern password hashing for your software and your servers.
+ * :pypi:`passlib`:
+ Comprehensive password hashing framework supporting over 30 schemes.
+ * :pypi:`argon2-cffi`:
+ The secure Argon2 password hashing algorithm.
+ * :pypi:`legacycrypt`:
+ :mod:`ctypes` wrapper to the POSIX crypt library call and associated functionality.
+ * :pypi:`crypt_r`:
+ Fork of the :mod:`!crypt` module, wrapper to the :manpage:`crypt_r(3)` library
+ call and associated functionality.
-(On Windows, use ``PCbuild/build.bat --experimental-jit`` to enable the JIT
-or ``--experimental-jit-interpreter`` to enable the Tier 2 interpreter.)
+ (Contributed by Victor Stinner in :gh:`104773`.)
-See :pep:`744` for more details.
+ * :mod:`!imghdr`: use the projects :pypi:`filetype`,
+ :pypi:`puremagic`, or :pypi:`python-magic` instead.
+ (Contributed by Victor Stinner in :gh:`104773`.)
-(JIT by Brandt Bucher, inspired by a paper by Haoran Xu and Fredrik Kjolstad.
-Tier 2 IR by Mark Shannon and Guido van Rossum.
-Tier 2 optimizer by Ken Jin.)
+ * :mod:`!mailcap`.
+ The :mod:`mimetypes` module provides an alternative.
+ (Contributed by Victor Stinner in :gh:`104773`.)
-.. _free-threaded-cpython:
+ * :mod:`!msilib`.
+ (Contributed by Zachary Ware in :gh:`104773`.)
-Free-threaded CPython
-=====================
+ * :mod:`!nis`.
+ (Contributed by Victor Stinner in :gh:`104773`.)
-CPython will run with the :term:`global interpreter lock` (GIL) disabled when
-configured using the ``--disable-gil`` option at build time. This is an
-experimental feature and therefore isn't used by default. Users need to
-either compile their own interpreter, or install one of the experimental
-builds that are marked as *free-threaded*.
+ * :mod:`!nntplib`:
+ the :pypi:`nntplib` PyPI project can be used instead.
+ (Contributed by Victor Stinner in :gh:`104773`.)
-Free-threaded execution allows for full utilization of the available
-processing power by running threads in parallel on available CPU cores.
-While not all software will benefit from this automatically, programs
-designed with threading in mind will run faster on multicore hardware.
+ * :mod:`!ossaudiodev`: use the
+ `pygame project <https://www.pygame.org/>`_ for audio playback.
+ (Contributed by Victor Stinner in :gh:`104780`.)
-Work is still ongoing: expect some bugs and a substantial single-threaded
-performance hit.
+ * :mod:`!pipes`: use the :mod:`subprocess` module instead.
+ (Contributed by Victor Stinner in :gh:`104773`.)
-The free-threaded build still supports optionally running with GIL enabled at
-runtime using the environment variable :envvar:`PYTHON_GIL` or the command line
-option :option:`-X gil`.
+ * :mod:`!sndhdr`: use the projects :pypi:`filetype`,
+ :pypi:`puremagic`, or :pypi:`python-magic` instead.
+ (Contributed by Victor Stinner in :gh:`104773`.)
-* Use :func:`!sys._is_gil_enabled` to determine if the :term:`GIL` is enabled.
+ * :mod:`!spwd`:
+ the :pypi:`python-pam` project can be used instead.
+ (Contributed by Victor Stinner in :gh:`104773`.)
+
+ * :mod:`!sunau`.
+ (Contributed by Victor Stinner in :gh:`104773`.)
+
+ * :mod:`!telnetlib`, use the projects :pypi:`telnetlib3 ` or
+ :pypi:`Exscript` instead.
+ (Contributed by Victor Stinner in :gh:`104773`.)
+
+ * :mod:`!uu`: the :mod:`base64` module is a modern alternative.
+ (Contributed by Victor Stinner in :gh:`104773`.)
+
+ * :mod:`!xdrlib`.
+ (Contributed by Victor Stinner in :gh:`104773`.)
-* Use ``sysconfig.get_config_var("Py_GIL_DISABLED")`` to identify CPython
- builds configured with ``--disable-gil``.
+* Remove the ``2to3`` program and the :mod:`!lib2to3` module,
+ deprecated in Python 3.11.
+ (Contributed by Victor Stinner in :gh:`104780`.)
-C-API extensions need to be built specifically for the free-threaded build.
+* Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The
+ third-party Tix library which the module wrapped is unmaintained.
+ (Contributed by Zachary Ware in :gh:`75552`.)
-* Extensions that support running with the :term:`GIL` disabled should use
- the :c:data:`Py_mod_gil` slot. Extensions using single-phase init should use
- :c:func:`PyUnstable_Module_SetGIL` to indicate whether they support running
- with the GIL disabled. Importing C extensions that don't use these mechanisms
- will cause the GIL to be enabled unless the GIL was explicitly disabled with
- the :envvar:`PYTHON_GIL` environment variable or the :option:`-X gil=0`
- option.
+configparser
+------------
-* pip 24.1b1 or newer is required to install packages with C extensions in the
- free-threaded build.
+* Remove the undocumented :class:`!configparser.LegacyInterpolation` class,
+ deprecated in the docstring since Python 3.2,
+ and with a deprecation warning since Python 3.11.
+ (Contributed by Hugo van Kemenade in :gh:`104886`.)
+importlib
+---------
-Deprecated
-==========
+* Remove deprecated :meth:`~object.__getitem__` access for
+ :class:`!importlib.metadata.EntryPoint` objects.
+ (Contributed by Jason R. Coombs in :gh:`113175`.)
+
+locale
+------
+
+* Remove ``locale.resetlocale()`` function deprecated in Python 3.11:
+ use ``locale.setlocale(locale.LC_ALL, "")`` instead.
+ (Contributed by Victor Stinner in :gh:`104783`.)
+
+logging
+-------
+
+* :mod:`logging`: Remove undocumented and untested ``Logger.warn()`` and
+ ``LoggerAdapter.warn()`` methods and ``logging.warn()`` function. Deprecated
+ since Python 3.3, they were aliases to the :meth:`logging.Logger.warning`
+ method, :meth:`!logging.LoggerAdapter.warning` method and
+ :func:`logging.warning` function.
+ (Contributed by Victor Stinner in :gh:`105376`.)
+
+pathlib
+-------
+
+* Remove support for using :class:`pathlib.Path` objects as context managers.
+ This functionality was deprecated and made a no-op in Python 3.9.
+
+re
+--
+
+* Remove undocumented, never working, and deprecated ``re.template`` function
+ and ``re.TEMPLATE`` flag (and ``re.T`` alias).
+ (Contributed by Serhiy Storchaka and Nikita Sobolev in :gh:`105687`.)
+
+
+turtle
+------
+
+* Remove the :meth:`!turtle.RawTurtle.settiltangle` method,
+ deprecated in docs since Python 3.1
+ and with a deprecation warning since Python 3.11.
+ (Contributed by Hugo van Kemenade in :gh:`104876`.)
+
+typing
+------
+
+* Namespaces ``typing.io`` and ``typing.re``, deprecated in Python 3.8,
+ are now removed. The items in those namespaces can be imported directly
+ from :mod:`typing`. (Contributed by Sebastian Rittau in :gh:`92871`.)
+
+* Remove support for the keyword-argument method of creating
+ :class:`typing.TypedDict` types, deprecated in Python 3.11.
+ (Contributed by Tomas Roun in :gh:`104786`.)
+
+unittest
+--------
+
+* Remove the following :mod:`unittest` functions, deprecated in Python 3.11:
+
+ * :func:`!unittest.findTestCases`
+ * :func:`!unittest.makeSuite`
+ * :func:`!unittest.getTestCaseNames`
+
+ Use :class:`~unittest.TestLoader` methods instead:
+
+ * :meth:`unittest.TestLoader.loadTestsFromModule`
+ * :meth:`unittest.TestLoader.loadTestsFromTestCase`
+ * :meth:`unittest.TestLoader.getTestCaseNames`
+
+ (Contributed by Hugo van Kemenade in :gh:`104835`.)
+
+* Remove the untested and undocumented :meth:`!unittest.TestProgram.usageExit`
+ method, deprecated in Python 3.11.
+ (Contributed by Hugo van Kemenade in :gh:`104992`.)
+
+urllib
+------
+
+* Remove *cafile*, *capath* and *cadefault* parameters of the
+ :func:`urllib.request.urlopen` function, deprecated in Python 3.6: pass
+ the *context* parameter instead. Use
+ :meth:`ssl.SSLContext.load_cert_chain` to load specific certificates, or
+ let :func:`ssl.create_default_context` select the system's trusted CA
+ certificates for you.
+ (Contributed by Victor Stinner in :gh:`105382`.)
+
+webbrowser
+----------
+
+* Remove the untested and undocumented :mod:`webbrowser` :class:`!MacOSX` class,
+ deprecated in Python 3.11.
+ Use the :class:`!MacOSXOSAScript` class (introduced in Python 3.2) instead.
+ (Contributed by Hugo van Kemenade in :gh:`104804`.)
+
+* Remove deprecated ``webbrowser.MacOSXOSAScript._name`` attribute.
+ Use :attr:`webbrowser.MacOSXOSAScript.name <webbrowser.controller.name>`
+ attribute instead.
+ (Contributed by Nikita Sobolev in :gh:`105546`.)
+
+New Deprecations
+================
+
+* Removed chained :class:`classmethod` descriptors (introduced in
+ :gh:`63272`). This can no longer be used to wrap other descriptors
+ such as :class:`property`. The core design of this feature was flawed
+ and caused a number of downstream problems. To "pass-through" a
+ :class:`classmethod`, consider using the :attr:`!__wrapped__`
+ attribute that was added in Python 3.10. (Contributed by Raymond
+ Hettinger in :gh:`89519`.)
* :mod:`array`: :mod:`array`'s ``'u'`` format code, deprecated in docs since Python 3.3,
emits :exc:`DeprecationWarning` since 3.13
@@ -1161,6 +1439,16 @@ Deprecated
security and functionality bugs. This includes removal of the ``--cgi``
flag to the ``python -m http.server`` command line in 3.15.
+* :mod:`mimetypes`: Passing file path instead of URL in :func:`~mimetypes.guess_type` is
+ :term:`soft deprecated`. Use :func:`~mimetypes.guess_file_type` instead.
+ (Contributed by Serhiy Storchaka in :gh:`66543`.)
+
+* :mod:`re`: Passing optional arguments *maxsplit*, *count* and *flags* in module-level
+ functions :func:`re.split`, :func:`re.sub` and :func:`re.subn` as positional
+ arguments is now deprecated. In future Python versions these parameters will be
+ :ref:`keyword-only <keyword-only_parameter>`.
+ (Contributed by Serhiy Storchaka in :gh:`56166`.)
+
* :mod:`pathlib`:
:meth:`pathlib.PurePath.is_reserved` is deprecated and scheduled for
removal in Python 3.15. Use :func:`os.path.isreserved` to detect reserved
@@ -1250,10 +1538,6 @@ Deprecated
.. Add deprecations above alphabetically, not here at the end.
-* Passing file path instead of URL in :func:`~mimetypes.guess_type` is :term:`soft deprecated`.
- Use :func:`~mimetypes.guess_file_type` instead.
- (Contributed by Serhiy Storchaka in :gh:`66543`.)
-
Pending Removal in Python 3.14
------------------------------
@@ -1361,6 +1645,7 @@ Pending Removal in Python 3.14
:class:`~xml.etree.ElementTree.Element` is deprecated and will raise an
exception in Python 3.14.
+
Pending Removal in Python 3.15
------------------------------
@@ -1566,241 +1851,7 @@ although there is currently no date scheduled for their removal.
use :meth:`~zipimport.zipimporter.exec_module` instead.
-Removed
-=======
-
-.. _whatsnew313-pep594:
-
-PEP 594: dead batteries
------------------------
-
-* :pep:`594` removed 19 modules from the standard library,
- deprecated in Python 3.11:
-
- * :mod:`!aifc`.
- (Contributed by Victor Stinner in :gh:`104773`.)
-
- * :mod:`!audioop`.
- (Contributed by Victor Stinner in :gh:`104773`.)
-
- * :mod:`!chunk`.
- (Contributed by Victor Stinner in :gh:`104773`.)
-
- * :mod:`!cgi` and :mod:`!cgitb`.
-
- * ``cgi.FieldStorage`` can typically be replaced with
- :func:`urllib.parse.parse_qsl` for ``GET`` and ``HEAD`` requests,
- and the :mod:`email.message` module or :pypi:`multipart`
- PyPI project for ``POST`` and ``PUT``.
-
- * ``cgi.parse()`` can be replaced by calling :func:`urllib.parse.parse_qs`
- directly on the desired query string, except for ``multipart/form-data``
- input, which can be handled as described for ``cgi.parse_multipart()``.
-
- * ``cgi.parse_header()`` can be replaced with the functionality in the
- :mod:`email` package, which implements the same MIME RFCs. For example,
- with :class:`email.message.EmailMessage`::
-
- from email.message import EmailMessage
- msg = EmailMessage()
- msg['content-type'] = 'application/json; charset="utf8"'
- main, params = msg.get_content_type(), msg['content-type'].params
-
- * ``cgi.parse_multipart()`` can be replaced with the functionality in the
- :mod:`email` package (e.g. :class:`email.message.EmailMessage` and
- :class:`email.message.Message`) which implements the same MIME RFCs, or
- with the :pypi:`multipart` PyPI project.
-
- (Contributed by Victor Stinner in :gh:`104773`.)
-
- * :mod:`!crypt` module and its private :mod:`!_crypt` extension.
- The :mod:`hashlib` module is a potential replacement for certain use cases.
- Otherwise, the following PyPI projects can be used:
-
- * :pypi:`bcrypt`:
- Modern password hashing for your software and your servers.
- * :pypi:`passlib`:
- Comprehensive password hashing framework supporting over 30 schemes.
- * :pypi:`argon2-cffi`:
- The secure Argon2 password hashing algorithm.
- * :pypi:`legacycrypt`:
- :mod:`ctypes` wrapper to the POSIX crypt library call and associated functionality.
- * :pypi:`crypt_r`:
- Fork of the :mod:`!crypt` module, wrapper to the :manpage:`crypt_r(3)` library
- call and associated functionality.
-
- (Contributed by Victor Stinner in :gh:`104773`.)
-
- * :mod:`!imghdr`: use the projects :pypi:`filetype`,
- :pypi:`puremagic`, or :pypi:`python-magic` instead.
- (Contributed by Victor Stinner in :gh:`104773`.)
-
- * :mod:`!mailcap`.
- The :mod:`mimetypes` module provides an alternative.
- (Contributed by Victor Stinner in :gh:`104773`.)
-
- * :mod:`!msilib`.
- (Contributed by Zachary Ware in :gh:`104773`.)
-
- * :mod:`!nis`.
- (Contributed by Victor Stinner in :gh:`104773`.)
-
- * :mod:`!nntplib`:
- the :pypi:`nntplib` PyPI project can be used instead.
- (Contributed by Victor Stinner in :gh:`104773`.)
-
- * :mod:`!ossaudiodev`: use the
- `pygame project <https://www.pygame.org/>`_ for audio playback.
- (Contributed by Victor Stinner in :gh:`104780`.)
-
- * :mod:`!pipes`: use the :mod:`subprocess` module instead.
- (Contributed by Victor Stinner in :gh:`104773`.)
-
- * :mod:`!sndhdr`: use the projects :pypi:`filetype`,
- :pypi:`puremagic`, or :pypi:`python-magic` instead.
- (Contributed by Victor Stinner in :gh:`104773`.)
-
- * :mod:`!spwd`:
- the :pypi:`python-pam` project can be used instead.
- (Contributed by Victor Stinner in :gh:`104773`.)
-
- * :mod:`!sunau`.
- (Contributed by Victor Stinner in :gh:`104773`.)
-
- * :mod:`!telnetlib`, use the projects :pypi:`telnetlib3 ` or
- :pypi:`Exscript` instead.
- (Contributed by Victor Stinner in :gh:`104773`.)
-
- * :mod:`!uu`: the :mod:`base64` module is a modern alternative.
- (Contributed by Victor Stinner in :gh:`104773`.)
-
- * :mod:`!xdrlib`.
- (Contributed by Victor Stinner in :gh:`104773`.)
-
-2to3
-----
-
-* Remove the ``2to3`` program and the :mod:`!lib2to3` module,
- deprecated in Python 3.11.
- (Contributed by Victor Stinner in :gh:`104780`.)
-
-configparser
-------------
-
-* Remove the undocumented :class:`!configparser.LegacyInterpolation` class,
- deprecated in the docstring since Python 3.2,
- and with a deprecation warning since Python 3.11.
- (Contributed by Hugo van Kemenade in :gh:`104886`.)
-
-importlib
----------
-
-* Remove deprecated :meth:`~object.__getitem__` access for
- :class:`!importlib.metadata.EntryPoint` objects.
- (Contributed by Jason R. Coombs in :gh:`113175`.)
-
-locale
-------
-
-* Remove ``locale.resetlocale()`` function deprecated in Python 3.11:
- use ``locale.setlocale(locale.LC_ALL, "")`` instead.
- (Contributed by Victor Stinner in :gh:`104783`.)
-
-logging
--------
-
-* :mod:`logging`: Remove undocumented and untested ``Logger.warn()`` and
- ``LoggerAdapter.warn()`` methods and ``logging.warn()`` function. Deprecated
- since Python 3.3, they were aliases to the :meth:`logging.Logger.warning`
- method, :meth:`!logging.LoggerAdapter.warning` method and
- :func:`logging.warning` function.
- (Contributed by Victor Stinner in :gh:`105376`.)
-
-pathlib
--------
-
-* Remove support for using :class:`pathlib.Path` objects as context managers.
- This functionality was deprecated and made a no-op in Python 3.9.
-
-re
---
-
-* Remove undocumented, never working, and deprecated ``re.template`` function
- and ``re.TEMPLATE`` flag (and ``re.T`` alias).
- (Contributed by Serhiy Storchaka and Nikita Sobolev in :gh:`105687`.)
-
-tkinter
--------
-
-* Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The
- third-party Tix library which the module wrapped is unmaintained.
- (Contributed by Zachary Ware in :gh:`75552`.)
-
-turtle
-------
-
-* Remove the :meth:`!turtle.RawTurtle.settiltangle` method,
- deprecated in docs since Python 3.1
- and with a deprecation warning since Python 3.11.
- (Contributed by Hugo van Kemenade in :gh:`104876`.)
-
-typing
-------
-
-* Namespaces ``typing.io`` and ``typing.re``, deprecated in Python 3.8,
- are now removed. The items in those namespaces can be imported directly
- from :mod:`typing`. (Contributed by Sebastian Rittau in :gh:`92871`.)
-
-* Remove support for the keyword-argument method of creating
- :class:`typing.TypedDict` types, deprecated in Python 3.11.
- (Contributed by Tomas Roun in :gh:`104786`.)
-
-unittest
---------
-
-* Removed the following :mod:`unittest` functions, deprecated in Python 3.11:
-
- * :func:`!unittest.findTestCases`
- * :func:`!unittest.makeSuite`
- * :func:`!unittest.getTestCaseNames`
-
- Use :class:`~unittest.TestLoader` methods instead:
-
- * :meth:`unittest.TestLoader.loadTestsFromModule`
- * :meth:`unittest.TestLoader.loadTestsFromTestCase`
- * :meth:`unittest.TestLoader.getTestCaseNames`
-
- (Contributed by Hugo van Kemenade in :gh:`104835`.)
-
-* Remove the untested and undocumented :meth:`!unittest.TestProgram.usageExit`
- method, deprecated in Python 3.11.
- (Contributed by Hugo van Kemenade in :gh:`104992`.)
-
-urllib
-------
-
-* Remove *cafile*, *capath* and *cadefault* parameters of the
- :func:`urllib.request.urlopen` function, deprecated in Python 3.6: use the
- *context* parameter instead. Please use
- :meth:`ssl.SSLContext.load_cert_chain` instead, or let
- :func:`ssl.create_default_context` select the system's trusted CA
- certificates for you.
- (Contributed by Victor Stinner in :gh:`105382`.)
-
-webbrowser
-----------
-
-* Remove the untested and undocumented :mod:`webbrowser` :class:`!MacOSX` class,
- deprecated in Python 3.11.
- Use the :class:`!MacOSXOSAScript` class (introduced in Python 3.2) instead.
- (Contributed by Hugo van Kemenade in :gh:`104804`.)
-
-* Remove deprecated ``webbrowser.MacOSXOSAScript._name`` attribute.
- Use :attr:`webbrowser.MacOSXOSAScript.name <webbrowser.controller.name>`
- attribute instead.
- (Contributed by Nikita Sobolev in :gh:`105546`.)
-
-CPython bytecode changes
+CPython Bytecode Changes
========================
* The oparg of ``YIELD_VALUE`` is now ``1`` if the yield is part of a
@@ -1809,108 +1860,6 @@ CPython bytecode changes
is needed to optimize closing of generators.
(Contributed by Irit Katriel in :gh:`111354`.)
-Porting to Python 3.13
-======================
-
-This section lists previously described changes and other bugfixes
-that may require changes to your code.
-
-Changes in the Python API
--------------------------
-
-* Functions :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`,
- :c:func:`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`,
- :c:func:`PyObject_HasAttr`, :c:func:`PyObject_HasAttrString`, and
- :c:func:`PySys_GetObject`, which clear all errors which occurred when calling
- them, now report them using :func:`sys.unraisablehook`.
- You may replace them with other functions as
- recommended in the documentation.
- (Contributed by Serhiy Storchaka in :gh:`106672`.)
-
-* An :exc:`OSError` is now raised by :func:`getpass.getuser` for any failure to
- retrieve a username, instead of :exc:`ImportError` on non-Unix platforms or
- :exc:`KeyError` on Unix platforms where the password database is empty.
-
-* The :mod:`threading` module now expects the :mod:`!_thread` module to have
- an ``_is_main_interpreter`` attribute. It is a function with no
- arguments that return ``True`` if the current interpreter is the
- main interpreter.
-
- Any library or application that provides a custom ``_thread`` module
- must provide ``_is_main_interpreter()``, just like the module's
- other "private" attributes.
- (See :gh:`112826`.)
-
-* :class:`mailbox.Maildir` now ignores files with a leading dot.
- (Contributed by Zackery Spytz in :gh:`65559`.)
-
-* :meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` now return both
- files and directories if a pattern that ends with "``**``" is given, rather
- than directories only. Users may add a trailing slash to match only
- directories.
-
-* The value of the :attr:`!mode` attribute of :class:`gzip.GzipFile` was
- changed from integer (``1`` or ``2``) to string (``'rb'`` or ``'wb'``).
- The value of the :attr:`!mode` attribute of the readable file-like object
- returned by :meth:`zipfile.ZipFile.open` was changed from ``'r'`` to ``'rb'``.
- (Contributed by Serhiy Storchaka in :gh:`115961`.)
-
-* :c:func:`!PyCode_GetFirstFree` is an unstable API now and has been renamed
- to :c:func:`PyUnstable_Code_GetFirstFree`.
- (Contributed by Bogdan Romanyuk in :gh:`115781`.)
-
-* Callbacks registered in the :mod:`tkinter` module now take arguments as
- various Python objects (``int``, ``float``, ``bytes``, ``tuple``),
- not just ``str``.
- To restore the previous behavior set :mod:`!tkinter` module global
- :data:`!wantobject` to ``1`` before creating the
- :class:`!Tk` object or call the :meth:`!wantobject`
- method of the :class:`!Tk` object with argument ``1``.
- Calling it with argument ``2`` restores the current default behavior.
- (Contributed by Serhiy Storchaka in :gh:`66410`.)
-
-
-Build Changes
-=============
-
-* The :file:`configure` option :option:`--with-system-libmpdec` now defaults
- to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python
- 3.15.
-
-* Autoconf 2.71 and aclocal 1.16.4 are now required to regenerate
- the :file:`configure` script.
- (Contributed by Christian Heimes in :gh:`89886`.)
-
-* SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension module.
- (Contributed by Erlend Aasland in :gh:`105875`.)
-
-* Python built with :file:`configure` :option:`--with-trace-refs` (tracing
- references) is now ABI compatible with the Python release build and
- :ref:`debug build <debug-build>`.
- (Contributed by Victor Stinner in :gh:`108634`.)
-
-* Building CPython now requires a compiler with support for the C11 atomic
- library, GCC built-in atomic functions, or MSVC interlocked intrinsics.
-
-* The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``,
- ``termios``, ``winsound``,
- ``_ctypes_test``, ``_multiprocessing.posixshmem``, ``_scproxy``, ``_stat``,
- ``_statistics``, ``_testconsole``, ``_testimportmultiple`` and ``_uuid``
- C extensions are now built with the
- :ref:`limited C API <limited-c-api>`.
- (Contributed by Victor Stinner in :gh:`85283`.)
-
-* ``wasm32-wasi`` is now a :pep:`11` tier 2 platform.
- (Contributed by Brett Cannon in :gh:`115192`.)
-
-* ``wasm32-emscripten`` is no longer a :pep:`11` supported platform.
- (Contributed by Brett Cannon in :gh:`115192`.)
-
-* Python now bundles the `mimalloc library <https://github.com/microsoft/mimalloc>`__.
- It is licensed under the MIT license, see :ref:`mimalloc license <mimalloc-license>`.
- The bundled mimalloc has custom changes, see :gh:`113141` for details.
- (Contributed by Dino Viehland in :gh:`109914`.)
-
C API Changes
=============
@@ -2128,8 +2077,97 @@ New Features
by Pablo Galindo in :gh:`93502`.)
+Build Changes
+=============
+
+* The :file:`configure` option :option:`--with-system-libmpdec` now defaults
+ to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python
+ 3.15.
+
+* Autoconf 2.71 and aclocal 1.16.4 are now required to regenerate
+ the :file:`configure` script.
+ (Contributed by Christian Heimes in :gh:`89886`.)
+
+* SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension module.
+ (Contributed by Erlend Aasland in :gh:`105875`.)
+
+* Python built with :file:`configure` :option:`--with-trace-refs` (tracing
+ references) is now ABI compatible with the Python release build and
+ :ref:`debug build <debug-build>`.
+ (Contributed by Victor Stinner in :gh:`108634`.)
+
+* Building CPython now requires a compiler with support for the C11 atomic
+ library, GCC built-in atomic functions, or MSVC interlocked intrinsics.
+
+* The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``,
+ ``termios``, ``winsound``,
+ ``_ctypes_test``, ``_multiprocessing.posixshmem``, ``_scproxy``, ``_stat``,
+ ``_statistics``, ``_testconsole``, ``_testimportmultiple`` and ``_uuid``
+ C extensions are now built with the :ref:`limited C API <limited-c-api>`.
+ (Contributed by Victor Stinner in :gh:`85283`.)
+
+* ``wasm32-wasi`` is now a :pep:`11` tier 2 platform.
+ (Contributed by Brett Cannon in :gh:`115192`.)
+
+* ``wasm32-emscripten`` is no longer a :pep:`11` supported platform.
+ (Contributed by Brett Cannon in :gh:`115192`.)
+
+* Python now bundles the `mimalloc library <https://github.com/microsoft/mimalloc>`__.
+ It is licensed under the MIT license; see :ref:`mimalloc license <mimalloc-license>`.
+ The bundled mimalloc has custom changes, see :gh:`113141` for details.
+ (Contributed by Dino Viehland in :gh:`109914`.)
+
+
Porting to Python 3.13
-----------------------
+======================
+
+This section lists previously described changes and other bugfixes
+that may require changes to your code.
+
+Changes in the Python API
+-------------------------
+
+* An :exc:`OSError` is now raised by :func:`getpass.getuser` for any failure to
+ retrieve a username, instead of :exc:`ImportError` on non-Unix platforms or
+ :exc:`KeyError` on Unix platforms where the password database is empty.
+
+* The :mod:`threading` module now expects the :mod:`!_thread` module to have
+ an ``_is_main_interpreter`` attribute. It is a function with no
+ arguments that returns ``True`` if the current interpreter is the
+ main interpreter.
+
+ Any library or application that provides a custom ``_thread`` module
+ must provide ``_is_main_interpreter()``, just like the module's
+ other "private" attributes.
+ (See :gh:`112826`.)
+
+* :class:`mailbox.Maildir` now ignores files with a leading dot.
+ (Contributed by Zackery Spytz in :gh:`65559`.)
+
+* :meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` now return both
+ files and directories if a pattern that ends with "``**``" is given, rather
+ than directories only. Users may add a trailing slash to match only
+ directories.
+
+* The value of the :attr:`!mode` attribute of :class:`gzip.GzipFile` was
+ changed from integer (``1`` or ``2``) to string (``'rb'`` or ``'wb'``).
+ The value of the :attr:`!mode` attribute of the readable file-like object
+ returned by :meth:`zipfile.ZipFile.open` was changed from ``'r'`` to ``'rb'``.
+ (Contributed by Serhiy Storchaka in :gh:`115961`.)
+
+* Callbacks registered in the :mod:`tkinter` module now take arguments as
+ various Python objects (``int``, ``float``, ``bytes``, ``tuple``),
+ not just ``str``.
+ To restore the previous behavior set :mod:`!tkinter` module global
+ :data:`!wantobject` to ``1`` before creating the
+ :class:`!Tk` object or call the :meth:`!wantobject`
+ method of the :class:`!Tk` object with argument ``1``.
+ Calling it with argument ``2`` restores the current default behavior.
+ (Contributed by Serhiy Storchaka in :gh:`66410`.)
+
+
+Changes in the C API
+--------------------
* ``Python.h`` no longer includes the ``<ieeefp.h>`` standard header. It was
included for the ``finite()`` function which is now provided by the
@@ -2184,61 +2222,25 @@ Porting to Python 3.13
}
Note that ``Py_TRASHCAN_BEGIN`` has a second argument which
- should be the deallocation function it is in.
-
-Deprecated
-----------
-
-* Passing optional arguments *maxsplit*, *count* and *flags* in module-level
- functions :func:`re.split`, :func:`re.sub` and :func:`re.subn` as positional
- arguments is now deprecated.
- In future Python versions these parameters will be
- :ref:`keyword-only <keyword-only_parameter>`.
- (Contributed by Serhiy Storchaka in :gh:`56166`.)
-
-* Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types: use directly
- the :c:type:`wchar_t` type instead. Since Python 3.3, ``Py_UNICODE`` and
- ``PY_UNICODE_TYPE`` are just aliases to :c:type:`wchar_t`.
- (Contributed by Victor Stinner in :gh:`105156`.)
-
-* Deprecate old Python initialization functions:
-
- * :c:func:`PySys_ResetWarnOptions`:
- clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
- * :c:func:`Py_GetExecPrefix`: get :data:`sys.exec_prefix` instead.
- * :c:func:`Py_GetPath`: get :data:`sys.path` instead.
- * :c:func:`Py_GetPrefix`: get :data:`sys.prefix` instead.
- * :c:func:`Py_GetProgramFullPath`: get :data:`sys.executable` instead.
- * :c:func:`Py_GetProgramName`: get :data:`sys.executable` instead.
- * :c:func:`Py_GetPythonHome`: get :c:member:`PyConfig.home` or
- :envvar:`PYTHONHOME` environment variable instead.
-
- Functions scheduled for removal in Python 3.15.
- (Contributed by Victor Stinner in :gh:`105145`.)
-
-* Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function which is just
- an alias to :c:func:`PyImport_ImportModule` since Python 3.3.
- Scheduled for removal in Python 3.15.
- (Contributed by Victor Stinner in :gh:`105396`.)
+ should be the deallocation function it is in. The new macros were
+ added in Python 3.8 and the old macros were deprecated in Python 3.11.
+ (Contributed by Irit Katriel in :gh:`105111`.)
-* Deprecate the :c:func:`PyWeakref_GetObject` and
- :c:func:`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed
- reference`: use the new :c:func:`PyWeakref_GetRef` function instead, it
- returns a :term:`strong reference`. The `pythoncapi-compat project
- <https://github.com/python/pythoncapi-compat/>`__ can be used to get
- :c:func:`PyWeakref_GetRef` on Python 3.12 and older.
- (Contributed by Victor Stinner in :gh:`105927`.)
+* Functions :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`,
+ :c:func:`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`,
+ :c:func:`PyObject_HasAttr`, :c:func:`PyObject_HasAttrString`, and
+ :c:func:`PySys_GetObject`, which clear all errors which occurred when calling
+ them, now report them using :func:`sys.unraisablehook`.
+ You may replace them with other functions as
+ recommended in the documentation.
+ (Contributed by Serhiy Storchaka in :gh:`106672`.)
-Removed
--------
+* :c:func:`!PyCode_GetFirstFree` is an unstable API now and has been renamed
+ to :c:func:`PyUnstable_Code_GetFirstFree`.
+ (Contributed by Bogdan Romanyuk in :gh:`115781`.)
-* Removed chained :class:`classmethod` descriptors (introduced in
- :gh:`63272`). This can no longer be used to wrap other descriptors
- such as :class:`property`. The core design of this feature was flawed
- and caused a number of downstream problems. To "pass-through" a
- :class:`classmethod`, consider using the :attr:`!__wrapped__`
- attribute that was added in Python 3.10. (Contributed by Raymond
- Hettinger in :gh:`89519`.)
+Removed C APIs
+--------------
* Remove many APIs (functions, macros, variables) with names prefixed by
``_Py`` or ``_PY`` (considered as private API). If your project is affected
@@ -2318,12 +2320,6 @@ Removed
Configuration <init-config>` instead (:pep:`587`), added to Python 3.8.
(Contributed by Victor Stinner in :gh:`105145`.)
-* Remove the old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and
- ``Py_TRASHCAN_SAFE_END``. They should be replaced by the new macros
- ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``. The new macros were
- added in Python 3.8 and the old macros were deprecated in Python 3.11.
- (Contributed by Irit Katriel in :gh:`105111`.)
-
* Remove ``PyEval_ThreadsInitialized()``
function, deprecated in Python 3.9. Since Python 3.7, ``Py_Initialize()``
always creates the GIL: calling ``PyEval_InitThreads()`` does nothing and
@@ -2360,11 +2356,48 @@ Removed
be used instead.
(Contributed by Serhiy Storchaka in :gh:`86493`.)
+Deprecated C APIs
+-----------------
+
+* Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types: use directly
+ the :c:type:`wchar_t` type instead. Since Python 3.3, ``Py_UNICODE`` and
+ ``PY_UNICODE_TYPE`` are just aliases to :c:type:`wchar_t`.
+ (Contributed by Victor Stinner in :gh:`105156`.)
+
+* Deprecate old Python initialization functions:
+
+ * :c:func:`PySys_ResetWarnOptions`:
+ clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
+ * :c:func:`Py_GetExecPrefix`: get :data:`sys.exec_prefix` instead.
+ * :c:func:`Py_GetPath`: get :data:`sys.path` instead.
+ * :c:func:`Py_GetPrefix`: get :data:`sys.prefix` instead.
+ * :c:func:`Py_GetProgramFullPath`: get :data:`sys.executable` instead.
+ * :c:func:`Py_GetProgramName`: get :data:`sys.executable` instead.
+ * :c:func:`Py_GetPythonHome`: get :c:member:`PyConfig.home` or
+ :envvar:`PYTHONHOME` environment variable instead.
+
+ Functions scheduled for removal in Python 3.15.
+ (Contributed by Victor Stinner in :gh:`105145`.)
+
+* Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function which is just
+ an alias to :c:func:`PyImport_ImportModule` since Python 3.3.
+ Scheduled for removal in Python 3.15.
+ (Contributed by Victor Stinner in :gh:`105396`.)
+
+* Deprecate the :c:func:`PyWeakref_GetObject` and
+ :c:func:`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed
+ reference`: use the new :c:func:`PyWeakref_GetRef` function instead, it
+ returns a :term:`strong reference`. The `pythoncapi-compat project
+ <https://github.com/python/pythoncapi-compat/>`__ can be used to get
+ :c:func:`PyWeakref_GetRef` on Python 3.12 and older.
+ (Contributed by Victor Stinner in :gh:`105927`.)
+
Pending Removal in Python 3.14
------------------------------
* Creating immutable types (:c:macro:`Py_TPFLAGS_IMMUTABLETYPE`) with mutable
bases using the C API.
+
* Functions to configure the Python initialization, deprecated in Python 3.11:
* ``PySys_SetArgvEx()``: set :c:member:`PyConfig.argv` instead.