Skip to content

Commit dfb5d27

Browse files
authored
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
1 parent 22739a0 commit dfb5d27

File tree

1 file changed

+108
-82
lines changed

1 file changed

+108
-82
lines changed

Doc/whatsnew/3.11.rst

+108-82
Original file line numberDiff line numberDiff line change
@@ -1587,78 +1587,107 @@ This section lists Python APIs that have been deprecated in Python 3.11.
15871587

15881588
Deprecated C APIs are :ref:`listed separately <whatsnew311-c-api-deprecated>`.
15891589

1590+
1591+
.. _whatsnew311-deprecated-language:
1592+
.. _whatsnew311-deprecated-builtins:
1593+
1594+
Language/Builtins
1595+
-----------------
1596+
15901597
* Chaining :class:`classmethod` descriptors (introduced in :issue:`19072`)
15911598
is now deprecated. It can no longer be used to wrap other descriptors
15921599
such as :class:`property`. The core design of this feature was flawed
15931600
and caused a number of downstream problems. To "pass-through" a
1594-
:class:`classmethod`, consider using the ``__wrapped__`` attribute
1601+
:class:`classmethod`, consider using the :attr:`!__wrapped__` attribute
15951602
that was added in Python 3.10.
15961603
(Contributed by Raymond Hettinger in :gh:`89519`.)
15971604

1598-
* Octal escapes in string and bytes literals with value larger than ``0o377`` now
1599-
produce :exc:`DeprecationWarning`.
1600-
In a future Python version they will be a :exc:`SyntaxWarning` and
1605+
* Octal escapes in string and bytes literals with values larger than ``0o377``
1606+
(255 in decimal) now produce a :exc:`DeprecationWarning`.
1607+
In a future Python version, they will raise a :exc:`SyntaxWarning` and
16011608
eventually a :exc:`SyntaxError`.
16021609
(Contributed by Serhiy Storchaka in :gh:`81548`.)
16031610

1604-
* The :mod:`lib2to3` package and ``2to3`` tool are now deprecated and may not
1605-
be able to parse Python 3.10 or newer. See the :pep:`617` (New PEG parser for
1606-
CPython). (Contributed by Victor Stinner in :issue:`40360`.)
1611+
* The delegation of :func:`int` to :meth:`~object.__trunc__` is now deprecated.
1612+
Calling ``int(a)`` when ``type(a)`` implements :meth:`!__trunc__` but not
1613+
:meth:`~object.__int__` or :meth:`~object.__index__` now raises
1614+
a :exc:`DeprecationWarning`.
1615+
(Contributed by Zackery Spytz in :issue:`44977`.)
16071616

1608-
* Undocumented modules ``sre_compile``, ``sre_constants`` and ``sre_parse``
1609-
are now deprecated.
1610-
(Contributed by Serhiy Storchaka in :issue:`47152`.)
16111617

1612-
* :class:`webbrowser.MacOSX` is deprecated and will be removed in Python 3.13.
1613-
It is untested and undocumented and also not used by webbrowser itself.
1614-
(Contributed by Dong-hee Na in :issue:`42255`.)
1618+
.. _whatsnew311-deprecated-modules:
16151619

1616-
* The behavior of returning a value from a :class:`~unittest.TestCase` and
1617-
:class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the
1618-
default ``None`` value), is now deprecated.
1620+
Modules
1621+
-------
16191622

1620-
* Deprecated the following :mod:`unittest` functions, scheduled for removal in
1621-
Python 3.13:
1623+
.. _whatsnew311-pep594:
16221624

1623-
* :func:`unittest.findTestCases`
1624-
* :func:`unittest.makeSuite`
1625-
* :func:`unittest.getTestCaseNames`
1625+
* :pep:`594` led to the deprecations of the following modules
1626+
slated for removal in Python 3.13:
16261627

1627-
Use :class:`~unittest.TestLoader` method instead:
1628+
+---------------------+---------------------+---------------------+---------------------+---------------------+
1629+
| :mod:`aifc` | :mod:`chunk` | :mod:`msilib` | :mod:`pipes` | :mod:`telnetlib` |
1630+
+---------------------+---------------------+---------------------+---------------------+---------------------+
1631+
| :mod:`audioop` | :mod:`crypt` | :mod:`nis` | :mod:`sndhdr` | :mod:`uu` |
1632+
+---------------------+---------------------+---------------------+---------------------+---------------------+
1633+
| :mod:`cgi` | :mod:`imghdr` | :mod:`nntplib` | :mod:`spwd` | :mod:`xdrlib` |
1634+
+---------------------+---------------------+---------------------+---------------------+---------------------+
1635+
| :mod:`cgitb` | :mod:`mailcap` | :mod:`ossaudiodev` | :mod:`sunau` | |
1636+
+---------------------+---------------------+---------------------+---------------------+---------------------+
16281637

1629-
* :meth:`unittest.TestLoader.loadTestsFromModule`
1630-
* :meth:`unittest.TestLoader.loadTestsFromTestCase`
1631-
* :meth:`unittest.TestLoader.getTestCaseNames`
1638+
(Contributed by Brett Cannon in :issue:`47061` and Victor Stinner in
1639+
:gh:`68966`.)
16321640

1633-
(Contributed by Erlend E. Aasland in :issue:`5846`.)
1641+
* The :mod:`asynchat`, :mod:`asyncore` and :mod:`smtpd` modules have been
1642+
deprecated since at least Python 3.6. Their documentation and deprecation
1643+
warnings have now been updated to note they will removed in Python 3.12.
1644+
(Contributed by Hugo van Kemenade in :issue:`47022`.)
16341645

1635-
* The :meth:`turtle.RawTurtle.settiltangle` is deprecated since Python 3.1,
1636-
it now emits a deprecation warning and will be removed in Python 3.13. Use
1637-
:meth:`turtle.RawTurtle.tiltangle` instead (it was earlier incorrectly marked
1638-
as deprecated, its docstring is now corrected).
1639-
(Contributed by Hugo van Kemenade in :issue:`45837`.)
1646+
* The :mod:`lib2to3` package and :ref:`2to3 <2to3-reference>` tool
1647+
are now deprecated and may not be able to parse Python 3.10 or newer.
1648+
See :pep:`617`, introducing the new PEG parser, for details.
1649+
(Contributed by Victor Stinner in :issue:`40360`.)
1650+
1651+
* Undocumented modules :mod:`!sre_compile`, :mod:`!sre_constants`
1652+
and :mod:`!sre_parse` are now deprecated.
1653+
(Contributed by Serhiy Storchaka in :issue:`47152`.)
16401654

1641-
* The delegation of :func:`int` to :meth:`__trunc__` is now deprecated. Calling
1642-
``int(a)`` when ``type(a)`` implements :meth:`__trunc__` but not
1643-
:meth:`__int__` or :meth:`__index__` now raises a :exc:`DeprecationWarning`.
1644-
(Contributed by Zackery Spytz in :issue:`44977`.)
1655+
1656+
.. _whatsnew311-deprecated-stdlib:
1657+
1658+
Standard Library
1659+
----------------
16451660

16461661
* The following have been deprecated in :mod:`configparser` since Python 3.2.
16471662
Their deprecation warnings have now been updated to note they will removed in
16481663
Python 3.12:
16491664

1650-
* the :class:`configparser.SafeConfigParser` class
1651-
* the :attr:`configparser.ParsingError.filename` property
1665+
* the :class:`!configparser.SafeConfigParser` class
1666+
* the :attr:`!configparser.ParsingError.filename` property
16521667
* the :meth:`configparser.RawConfigParser.readfp` method
16531668

16541669
(Contributed by Hugo van Kemenade in :issue:`45173`.)
16551670

1656-
* :class:`configparser.LegacyInterpolation` has been deprecated in the docstring
1657-
since Python 3.2. It now emits a :exc:`DeprecationWarning` and will be removed
1671+
* :class:`!configparser.LegacyInterpolation` has been deprecated in the docstring
1672+
since Python 3.2, and is not listed in the :mod:`configparser` documentation.
1673+
It now emits a :exc:`DeprecationWarning` and will be removed
16581674
in Python 3.13. Use :class:`configparser.BasicInterpolation` or
16591675
:class:`configparser.ExtendedInterpolation` instead.
16601676
(Contributed by Hugo van Kemenade in :issue:`46607`.)
16611677

1678+
* The older set of :mod:`importlib.resources` functions were deprecated
1679+
in favor of the replacements added in Python 3.9
1680+
and will be removed in a future Python version,
1681+
due to not supporting resources located within package subdirectories:
1682+
1683+
* :func:`importlib.resources.contents`
1684+
* :func:`importlib.resources.is_resource`
1685+
* :func:`importlib.resources.open_binary`
1686+
* :func:`importlib.resources.open_text`
1687+
* :func:`importlib.resources.read_binary`
1688+
* :func:`importlib.resources.read_text`
1689+
* :func:`importlib.resources.path`
1690+
16621691
* The :func:`locale.getdefaultlocale` function is deprecated and will be
16631692
removed in Python 3.13. Use :func:`locale.setlocale`,
16641693
:func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>` and
@@ -1669,61 +1698,58 @@ Deprecated C APIs are :ref:`listed separately <whatsnew311-c-api-deprecated>`.
16691698
removed in Python 3.13. Use ``locale.setlocale(locale.LC_ALL, "")`` instead.
16701699
(Contributed by Victor Stinner in :gh:`90817`.)
16711700

1672-
.. _whatsnew311-pep594:
1673-
1674-
* :pep:`594` led to the deprecations of the following modules which are
1675-
slated for removal in Python 3.13:
1676-
1677-
* :mod:`aifc`
1678-
* :mod:`audioop`
1679-
* :mod:`cgi`
1680-
* :mod:`cgitb`
1681-
* :mod:`chunk`
1682-
* :mod:`crypt`
1683-
* :mod:`imghdr`
1684-
* :mod:`mailcap`
1685-
* :mod:`msilib`
1686-
* :mod:`nis`
1687-
* :mod:`nntplib`
1688-
* :mod:`ossaudiodev`
1689-
* :mod:`pipes`
1690-
* :mod:`sndhdr`
1691-
* :mod:`spwd`
1692-
* :mod:`sunau`
1693-
* :mod:`telnetlib`
1694-
* :mod:`uu`
1695-
* :mod:`xdrlib`
1696-
1697-
(Contributed by Brett Cannon in :issue:`47061` and Victor Stinner in
1698-
:gh:`68966`.)
1701+
* Stricter rules will now be applied for numerical group references
1702+
and group names in :ref:`regular expressions <re-syntax>`.
1703+
Only sequences of ASCII digits will now be accepted as a numerical reference,
1704+
and the group name in :class:`bytes` patterns and replacement strings
1705+
can only contain ASCII letters, digits and underscores.
1706+
For now, a deprecation warning is raised for syntax violating these rules.
1707+
(Contributed by Serhiy Storchaka in :gh:`91760`.)
16991708

1700-
* The :mod:`asynchat`, :mod:`asyncore` and :mod:`smtpd` modules have been
1701-
deprecated since at least Python 3.6. Their documentation and deprecation
1702-
warnings have now been updated to note they will removed in Python 3.12.
1703-
(Contributed by Hugo van Kemenade in :issue:`47022`.)
1709+
* In the :mod:`re` module, the :func:`!re.template` function
1710+
and the corresponding :data:`!re.TEMPLATE` and :data:`!re.T` flags
1711+
are deprecated, as they were undocumented and lacked an obvious purpose.
1712+
They will be removed in Python 3.13.
1713+
(Contributed by Serhiy Storchaka and Miro Hrončok in :gh:`92728`.)
17041714

1705-
* More strict rules will be applied now applied for numerical group references
1706-
and group names in regular expressions in future Python versions.
1707-
Only sequence of ASCII digits will be now accepted as a numerical reference.
1708-
The group name in bytes patterns and replacement strings could only
1709-
contain ASCII letters and digits and underscore.
1710-
For now, a deprecation warning is raised for such syntax.
1711-
(Contributed by Serhiy Storchaka in :gh:`91760`.)
1715+
* :func:`turtle.settiltangle` has been deprecated since Python 3.1;
1716+
it now emits a deprecation warning and will be removed in Python 3.13. Use
1717+
:func:`turtle.tiltangle` instead (it was earlier incorrectly marked
1718+
as deprecated, and its docstring is now corrected).
1719+
(Contributed by Hugo van Kemenade in :issue:`45837`.)
17121720

17131721
* :class:`typing.Text`, which exists solely to provide compatibility support
17141722
between Python 2 and Python 3 code, is now deprecated. Its removal is
17151723
currently unplanned, but users are encouraged to use :class:`str` instead
17161724
wherever possible.
17171725
(Contributed by Alex Waygood in :gh:`92332`.)
17181726

1719-
* The keyword argument syntax for constructing :data:`~typing.TypedDict` types
1727+
* The keyword argument syntax for constructing :data:`typing.TypedDict` types
17201728
is now deprecated. Support will be removed in Python 3.13. (Contributed by
17211729
Jingchen Ye in :gh:`90224`.)
17221730

1723-
* The :func:`re.template` function and the corresponding :const:`re.TEMPLATE`
1724-
and :const:`re.T` flags are deprecated, as they were undocumented and
1725-
lacked an obvious purpose. They will be removed in Python 3.13.
1726-
(Contributed by Serhiy Storchaka and Miro Hrončok in :gh:`92728`.)
1731+
* :class:`!webbrowser.MacOSX` is deprecated and will be removed in Python 3.13.
1732+
It is untested, undocumented, and not used by :mod:`webbrowser` itself.
1733+
(Contributed by Dong-hee Na in :issue:`42255`.)
1734+
1735+
* The behavior of returning a value from a :class:`~unittest.TestCase` and
1736+
:class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the
1737+
default ``None`` value) is now deprecated.
1738+
1739+
* Deprecated the following not-formally-documented :mod:`unittest` functions,
1740+
scheduled for removal in Python 3.13:
1741+
1742+
* :func:`!unittest.findTestCases`
1743+
* :func:`!unittest.makeSuite`
1744+
* :func:`!unittest.getTestCaseNames`
1745+
1746+
Use :class:`~unittest.TestLoader` methods instead:
1747+
1748+
* :meth:`unittest.TestLoader.loadTestsFromModule`
1749+
* :meth:`unittest.TestLoader.loadTestsFromTestCase`
1750+
* :meth:`unittest.TestLoader.getTestCaseNames`
1751+
1752+
(Contributed by Erlend E. Aasland in :issue:`5846`.)
17271753

17281754

17291755
.. _whatsnew311-pending-removal:

0 commit comments

Comments
 (0)