Skip to content
Snippets Groups Projects
Unverified Commit dfb5d272 authored by C.A.M. Gerlach's avatar C.A.M. Gerlach Committed by GitHub
Browse files

gh-95913: Edit & expand Deprecated section of 3.11 WhatsNew (#98581)

* Refine Sphinx syntax and grammar/phrasing in Deprecated section items
* Organize into lang/builtins, modules & stdlib sections
* Convert PEP 594 module list into a grid to not waste as much space
* Add importlib.resources deprecated functions to section
parent 22739a0e
No related branches found
No related tags found
No related merge requests found
...@@ -1587,78 +1587,107 @@ This section lists Python APIs that have been deprecated in Python 3.11. ...@@ -1587,78 +1587,107 @@ This section lists Python APIs that have been deprecated in Python 3.11.
Deprecated C APIs are :ref:`listed separately <whatsnew311-c-api-deprecated>`. Deprecated C APIs are :ref:`listed separately <whatsnew311-c-api-deprecated>`.
.. _whatsnew311-deprecated-language:
.. _whatsnew311-deprecated-builtins:
Language/Builtins
-----------------
* Chaining :class:`classmethod` descriptors (introduced in :issue:`19072`) * Chaining :class:`classmethod` descriptors (introduced in :issue:`19072`)
is now deprecated. It can no longer be used to wrap other descriptors is now deprecated. It can no longer be used to wrap other descriptors
such as :class:`property`. The core design of this feature was flawed such as :class:`property`. The core design of this feature was flawed
and caused a number of downstream problems. To "pass-through" a and caused a number of downstream problems. To "pass-through" a
:class:`classmethod`, consider using the ``__wrapped__`` attribute :class:`classmethod`, consider using the :attr:`!__wrapped__` attribute
that was added in Python 3.10. that was added in Python 3.10.
(Contributed by Raymond Hettinger in :gh:`89519`.) (Contributed by Raymond Hettinger in :gh:`89519`.)
* Octal escapes in string and bytes literals with value larger than ``0o377`` now * Octal escapes in string and bytes literals with values larger than ``0o377``
produce :exc:`DeprecationWarning`. (255 in decimal) now produce a :exc:`DeprecationWarning`.
In a future Python version they will be a :exc:`SyntaxWarning` and In a future Python version, they will raise a :exc:`SyntaxWarning` and
eventually a :exc:`SyntaxError`. eventually a :exc:`SyntaxError`.
(Contributed by Serhiy Storchaka in :gh:`81548`.) (Contributed by Serhiy Storchaka in :gh:`81548`.)
* The :mod:`lib2to3` package and ``2to3`` tool are now deprecated and may not * The delegation of :func:`int` to :meth:`~object.__trunc__` is now deprecated.
be able to parse Python 3.10 or newer. See the :pep:`617` (New PEG parser for Calling ``int(a)`` when ``type(a)`` implements :meth:`!__trunc__` but not
CPython). (Contributed by Victor Stinner in :issue:`40360`.) :meth:`~object.__int__` or :meth:`~object.__index__` now raises
a :exc:`DeprecationWarning`.
(Contributed by Zackery Spytz in :issue:`44977`.)
* Undocumented modules ``sre_compile``, ``sre_constants`` and ``sre_parse``
are now deprecated.
(Contributed by Serhiy Storchaka in :issue:`47152`.)
* :class:`webbrowser.MacOSX` is deprecated and will be removed in Python 3.13. .. _whatsnew311-deprecated-modules:
It is untested and undocumented and also not used by webbrowser itself.
(Contributed by Dong-hee Na in :issue:`42255`.)
* The behavior of returning a value from a :class:`~unittest.TestCase` and Modules
:class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the -------
default ``None`` value), is now deprecated.
* Deprecated the following :mod:`unittest` functions, scheduled for removal in .. _whatsnew311-pep594:
Python 3.13:
* :func:`unittest.findTestCases` * :pep:`594` led to the deprecations of the following modules
* :func:`unittest.makeSuite` slated for removal in Python 3.13:
* :func:`unittest.getTestCaseNames`
Use :class:`~unittest.TestLoader` method instead: +---------------------+---------------------+---------------------+---------------------+---------------------+
| :mod:`aifc` | :mod:`chunk` | :mod:`msilib` | :mod:`pipes` | :mod:`telnetlib` |
+---------------------+---------------------+---------------------+---------------------+---------------------+
| :mod:`audioop` | :mod:`crypt` | :mod:`nis` | :mod:`sndhdr` | :mod:`uu` |
+---------------------+---------------------+---------------------+---------------------+---------------------+
| :mod:`cgi` | :mod:`imghdr` | :mod:`nntplib` | :mod:`spwd` | :mod:`xdrlib` |
+---------------------+---------------------+---------------------+---------------------+---------------------+
| :mod:`cgitb` | :mod:`mailcap` | :mod:`ossaudiodev` | :mod:`sunau` | |
+---------------------+---------------------+---------------------+---------------------+---------------------+
* :meth:`unittest.TestLoader.loadTestsFromModule` (Contributed by Brett Cannon in :issue:`47061` and Victor Stinner in
* :meth:`unittest.TestLoader.loadTestsFromTestCase` :gh:`68966`.)
* :meth:`unittest.TestLoader.getTestCaseNames`
(Contributed by Erlend E. Aasland in :issue:`5846`.) * The :mod:`asynchat`, :mod:`asyncore` and :mod:`smtpd` modules have been
deprecated since at least Python 3.6. Their documentation and deprecation
warnings have now been updated to note they will removed in Python 3.12.
(Contributed by Hugo van Kemenade in :issue:`47022`.)
* The :meth:`turtle.RawTurtle.settiltangle` is deprecated since Python 3.1, * The :mod:`lib2to3` package and :ref:`2to3 <2to3-reference>` tool
it now emits a deprecation warning and will be removed in Python 3.13. Use are now deprecated and may not be able to parse Python 3.10 or newer.
:meth:`turtle.RawTurtle.tiltangle` instead (it was earlier incorrectly marked See :pep:`617`, introducing the new PEG parser, for details.
as deprecated, its docstring is now corrected). (Contributed by Victor Stinner in :issue:`40360`.)
(Contributed by Hugo van Kemenade in :issue:`45837`.)
* Undocumented modules :mod:`!sre_compile`, :mod:`!sre_constants`
and :mod:`!sre_parse` are now deprecated.
(Contributed by Serhiy Storchaka in :issue:`47152`.)
* The delegation of :func:`int` to :meth:`__trunc__` is now deprecated. Calling
``int(a)`` when ``type(a)`` implements :meth:`__trunc__` but not .. _whatsnew311-deprecated-stdlib:
:meth:`__int__` or :meth:`__index__` now raises a :exc:`DeprecationWarning`.
(Contributed by Zackery Spytz in :issue:`44977`.) Standard Library
----------------
* The following have been deprecated in :mod:`configparser` since Python 3.2. * The following have been deprecated in :mod:`configparser` since Python 3.2.
Their deprecation warnings have now been updated to note they will removed in Their deprecation warnings have now been updated to note they will removed in
Python 3.12: Python 3.12:
* the :class:`configparser.SafeConfigParser` class * the :class:`!configparser.SafeConfigParser` class
* the :attr:`configparser.ParsingError.filename` property * the :attr:`!configparser.ParsingError.filename` property
* the :meth:`configparser.RawConfigParser.readfp` method * the :meth:`configparser.RawConfigParser.readfp` method
(Contributed by Hugo van Kemenade in :issue:`45173`.) (Contributed by Hugo van Kemenade in :issue:`45173`.)
* :class:`configparser.LegacyInterpolation` has been deprecated in the docstring * :class:`!configparser.LegacyInterpolation` has been deprecated in the docstring
since Python 3.2. It now emits a :exc:`DeprecationWarning` and will be removed since Python 3.2, and is not listed in the :mod:`configparser` documentation.
It now emits a :exc:`DeprecationWarning` and will be removed
in Python 3.13. Use :class:`configparser.BasicInterpolation` or in Python 3.13. Use :class:`configparser.BasicInterpolation` or
:class:`configparser.ExtendedInterpolation` instead. :class:`configparser.ExtendedInterpolation` instead.
(Contributed by Hugo van Kemenade in :issue:`46607`.) (Contributed by Hugo van Kemenade in :issue:`46607`.)
* The older set of :mod:`importlib.resources` functions were deprecated
in favor of the replacements added in Python 3.9
and will be removed in a future Python version,
due to not supporting resources located within package subdirectories:
* :func:`importlib.resources.contents`
* :func:`importlib.resources.is_resource`
* :func:`importlib.resources.open_binary`
* :func:`importlib.resources.open_text`
* :func:`importlib.resources.read_binary`
* :func:`importlib.resources.read_text`
* :func:`importlib.resources.path`
* The :func:`locale.getdefaultlocale` function is deprecated and will be * The :func:`locale.getdefaultlocale` function is deprecated and will be
removed in Python 3.13. Use :func:`locale.setlocale`, removed in Python 3.13. Use :func:`locale.setlocale`,
:func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>` and :func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>` and
...@@ -1669,46 +1698,25 @@ Deprecated C APIs are :ref:`listed separately <whatsnew311-c-api-deprecated>`. ...@@ -1669,46 +1698,25 @@ Deprecated C APIs are :ref:`listed separately <whatsnew311-c-api-deprecated>`.
removed in Python 3.13. Use ``locale.setlocale(locale.LC_ALL, "")`` instead. removed in Python 3.13. Use ``locale.setlocale(locale.LC_ALL, "")`` instead.
(Contributed by Victor Stinner in :gh:`90817`.) (Contributed by Victor Stinner in :gh:`90817`.)
.. _whatsnew311-pep594: * Stricter rules will now be applied for numerical group references
and group names in :ref:`regular expressions <re-syntax>`.
* :pep:`594` led to the deprecations of the following modules which are Only sequences of ASCII digits will now be accepted as a numerical reference,
slated for removal in Python 3.13: and the group name in :class:`bytes` patterns and replacement strings
can only contain ASCII letters, digits and underscores.
* :mod:`aifc` For now, a deprecation warning is raised for syntax violating these rules.
* :mod:`audioop` (Contributed by Serhiy Storchaka in :gh:`91760`.)
* :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`
* :mod:`xdrlib`
(Contributed by Brett Cannon in :issue:`47061` and Victor Stinner in
:gh:`68966`.)
* The :mod:`asynchat`, :mod:`asyncore` and :mod:`smtpd` modules have been * In the :mod:`re` module, the :func:`!re.template` function
deprecated since at least Python 3.6. Their documentation and deprecation and the corresponding :data:`!re.TEMPLATE` and :data:`!re.T` flags
warnings have now been updated to note they will removed in Python 3.12. are deprecated, as they were undocumented and lacked an obvious purpose.
(Contributed by Hugo van Kemenade in :issue:`47022`.) They will be removed in Python 3.13.
(Contributed by Serhiy Storchaka and Miro Hrončok in :gh:`92728`.)
* More strict rules will be applied now applied for numerical group references * :func:`turtle.settiltangle` has been deprecated since Python 3.1;
and group names in regular expressions in future Python versions. it now emits a deprecation warning and will be removed in Python 3.13. Use
Only sequence of ASCII digits will be now accepted as a numerical reference. :func:`turtle.tiltangle` instead (it was earlier incorrectly marked
The group name in bytes patterns and replacement strings could only as deprecated, and its docstring is now corrected).
contain ASCII letters and digits and underscore. (Contributed by Hugo van Kemenade in :issue:`45837`.)
For now, a deprecation warning is raised for such syntax.
(Contributed by Serhiy Storchaka in :gh:`91760`.)
* :class:`typing.Text`, which exists solely to provide compatibility support * :class:`typing.Text`, which exists solely to provide compatibility support
between Python 2 and Python 3 code, is now deprecated. Its removal is between Python 2 and Python 3 code, is now deprecated. Its removal is
...@@ -1716,14 +1724,32 @@ Deprecated C APIs are :ref:`listed separately <whatsnew311-c-api-deprecated>`. ...@@ -1716,14 +1724,32 @@ Deprecated C APIs are :ref:`listed separately <whatsnew311-c-api-deprecated>`.
wherever possible. wherever possible.
(Contributed by Alex Waygood in :gh:`92332`.) (Contributed by Alex Waygood in :gh:`92332`.)
* The keyword argument syntax for constructing :data:`~typing.TypedDict` types * The keyword argument syntax for constructing :data:`typing.TypedDict` types
is now deprecated. Support will be removed in Python 3.13. (Contributed by is now deprecated. Support will be removed in Python 3.13. (Contributed by
Jingchen Ye in :gh:`90224`.) Jingchen Ye in :gh:`90224`.)
* The :func:`re.template` function and the corresponding :const:`re.TEMPLATE` * :class:`!webbrowser.MacOSX` is deprecated and will be removed in Python 3.13.
and :const:`re.T` flags are deprecated, as they were undocumented and It is untested, undocumented, and not used by :mod:`webbrowser` itself.
lacked an obvious purpose. They will be removed in Python 3.13. (Contributed by Dong-hee Na in :issue:`42255`.)
(Contributed by Serhiy Storchaka and Miro Hrončok in :gh:`92728`.)
* The behavior of returning a value from a :class:`~unittest.TestCase` and
:class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the
default ``None`` value) is now deprecated.
* Deprecated the following not-formally-documented :mod:`unittest` functions,
scheduled for removal in Python 3.13:
* :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 Erlend E. Aasland in :issue:`5846`.)
.. _whatsnew311-pending-removal: .. _whatsnew311-pending-removal:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment