Skip to content

Commit c7a6760

Browse files
CAM-Gerlachmiss-islington
authored andcommitted
pythongh-95913: Edit & expand Deprecated section of 3.11 WhatsNew (pythonGH-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 (cherry picked from commit dfb5d27) Co-authored-by: C.A.M. Gerlach <[email protected]>
1 parent 3e41c16 commit c7a6760

File tree

1 file changed

+108
-82
lines changed

1 file changed

+108
-82
lines changed

Doc/whatsnew/3.11.rst

Lines changed: 108 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,78 +1545,107 @@ This section lists Python APIs that have been deprecated in Python 3.11.
15451545

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

1548+
1549+
.. _whatsnew311-deprecated-language:
1550+
.. _whatsnew311-deprecated-builtins:
1551+
1552+
Language/Builtins
1553+
-----------------
1554+
15481555
* Chaining :class:`classmethod` descriptors (introduced in :issue:`19072`)
15491556
is now deprecated. It can no longer be used to wrap other descriptors
15501557
such as :class:`property`. The core design of this feature was flawed
15511558
and caused a number of downstream problems. To "pass-through" a
1552-
:class:`classmethod`, consider using the ``__wrapped__`` attribute
1559+
:class:`classmethod`, consider using the :attr:`!__wrapped__` attribute
15531560
that was added in Python 3.10.
15541561
(Contributed by Raymond Hettinger in :gh:`89519`.)
15551562

1556-
* Octal escapes in string and bytes literals with value larger than ``0o377`` now
1557-
produce :exc:`DeprecationWarning`.
1558-
In a future Python version they will be a :exc:`SyntaxWarning` and
1563+
* Octal escapes in string and bytes literals with values larger than ``0o377``
1564+
(255 in decimal) now produce a :exc:`DeprecationWarning`.
1565+
In a future Python version, they will raise a :exc:`SyntaxWarning` and
15591566
eventually a :exc:`SyntaxError`.
15601567
(Contributed by Serhiy Storchaka in :gh:`81548`.)
15611568

1562-
* The :mod:`lib2to3` package and ``2to3`` tool are now deprecated and may not
1563-
be able to parse Python 3.10 or newer. See the :pep:`617` (New PEG parser for
1564-
CPython). (Contributed by Victor Stinner in :issue:`40360`.)
1569+
* The delegation of :func:`int` to :meth:`~object.__trunc__` is now deprecated.
1570+
Calling ``int(a)`` when ``type(a)`` implements :meth:`!__trunc__` but not
1571+
:meth:`~object.__int__` or :meth:`~object.__index__` now raises
1572+
a :exc:`DeprecationWarning`.
1573+
(Contributed by Zackery Spytz in :issue:`44977`.)
15651574

1566-
* Undocumented modules ``sre_compile``, ``sre_constants`` and ``sre_parse``
1567-
are now deprecated.
1568-
(Contributed by Serhiy Storchaka in :issue:`47152`.)
15691575

1570-
* :class:`webbrowser.MacOSX` is deprecated and will be removed in Python 3.13.
1571-
It is untested and undocumented and also not used by webbrowser itself.
1572-
(Contributed by Dong-hee Na in :issue:`42255`.)
1576+
.. _whatsnew311-deprecated-modules:
15731577

1574-
* The behavior of returning a value from a :class:`~unittest.TestCase` and
1575-
:class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the
1576-
default ``None`` value), is now deprecated.
1578+
Modules
1579+
-------
15771580

1578-
* Deprecated the following :mod:`unittest` functions, scheduled for removal in
1579-
Python 3.13:
1581+
.. _whatsnew311-pep594:
15801582

1581-
* :func:`unittest.findTestCases`
1582-
* :func:`unittest.makeSuite`
1583-
* :func:`unittest.getTestCaseNames`
1583+
* :pep:`594` led to the deprecations of the following modules
1584+
slated for removal in Python 3.13:
15841585

1585-
Use :class:`~unittest.TestLoader` method instead:
1586+
+---------------------+---------------------+---------------------+---------------------+---------------------+
1587+
| :mod:`aifc` | :mod:`chunk` | :mod:`msilib` | :mod:`pipes` | :mod:`telnetlib` |
1588+
+---------------------+---------------------+---------------------+---------------------+---------------------+
1589+
| :mod:`audioop` | :mod:`crypt` | :mod:`nis` | :mod:`sndhdr` | :mod:`uu` |
1590+
+---------------------+---------------------+---------------------+---------------------+---------------------+
1591+
| :mod:`cgi` | :mod:`imghdr` | :mod:`nntplib` | :mod:`spwd` | :mod:`xdrlib` |
1592+
+---------------------+---------------------+---------------------+---------------------+---------------------+
1593+
| :mod:`cgitb` | :mod:`mailcap` | :mod:`ossaudiodev` | :mod:`sunau` | |
1594+
+---------------------+---------------------+---------------------+---------------------+---------------------+
15861595

1587-
* :meth:`unittest.TestLoader.loadTestsFromModule`
1588-
* :meth:`unittest.TestLoader.loadTestsFromTestCase`
1589-
* :meth:`unittest.TestLoader.getTestCaseNames`
1596+
(Contributed by Brett Cannon in :issue:`47061` and Victor Stinner in
1597+
:gh:`68966`.)
15901598

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

1593-
* The :meth:`turtle.RawTurtle.settiltangle` is deprecated since Python 3.1,
1594-
it now emits a deprecation warning and will be removed in Python 3.13. Use
1595-
:meth:`turtle.RawTurtle.tiltangle` instead (it was earlier incorrectly marked
1596-
as deprecated, its docstring is now corrected).
1597-
(Contributed by Hugo van Kemenade in :issue:`45837`.)
1604+
* The :mod:`lib2to3` package and :ref:`2to3 <2to3-reference>` tool
1605+
are now deprecated and may not be able to parse Python 3.10 or newer.
1606+
See :pep:`617`, introducing the new PEG parser, for details.
1607+
(Contributed by Victor Stinner in :issue:`40360`.)
1608+
1609+
* Undocumented modules :mod:`!sre_compile`, :mod:`!sre_constants`
1610+
and :mod:`!sre_parse` are now deprecated.
1611+
(Contributed by Serhiy Storchaka in :issue:`47152`.)
15981612

1599-
* The delegation of :func:`int` to :meth:`__trunc__` is now deprecated. Calling
1600-
``int(a)`` when ``type(a)`` implements :meth:`__trunc__` but not
1601-
:meth:`__int__` or :meth:`__index__` now raises a :exc:`DeprecationWarning`.
1602-
(Contributed by Zackery Spytz in :issue:`44977`.)
1613+
1614+
.. _whatsnew311-deprecated-stdlib:
1615+
1616+
Standard Library
1617+
----------------
16031618

16041619
* The following have been deprecated in :mod:`configparser` since Python 3.2.
16051620
Their deprecation warnings have now been updated to note they will removed in
16061621
Python 3.12:
16071622

1608-
* the :class:`configparser.SafeConfigParser` class
1609-
* the :attr:`configparser.ParsingError.filename` property
1623+
* the :class:`!configparser.SafeConfigParser` class
1624+
* the :attr:`!configparser.ParsingError.filename` property
16101625
* the :meth:`configparser.RawConfigParser.readfp` method
16111626

16121627
(Contributed by Hugo van Kemenade in :issue:`45173`.)
16131628

1614-
* :class:`configparser.LegacyInterpolation` has been deprecated in the docstring
1615-
since Python 3.2. It now emits a :exc:`DeprecationWarning` and will be removed
1629+
* :class:`!configparser.LegacyInterpolation` has been deprecated in the docstring
1630+
since Python 3.2, and is not listed in the :mod:`configparser` documentation.
1631+
It now emits a :exc:`DeprecationWarning` and will be removed
16161632
in Python 3.13. Use :class:`configparser.BasicInterpolation` or
16171633
:class:`configparser.ExtendedInterpolation` instead.
16181634
(Contributed by Hugo van Kemenade in :issue:`46607`.)
16191635

1636+
* The older set of :mod:`importlib.resources` functions were deprecated
1637+
in favor of the replacements added in Python 3.9
1638+
and will be removed in a future Python version,
1639+
due to not supporting resources located within package subdirectories:
1640+
1641+
* :func:`importlib.resources.contents`
1642+
* :func:`importlib.resources.is_resource`
1643+
* :func:`importlib.resources.open_binary`
1644+
* :func:`importlib.resources.open_text`
1645+
* :func:`importlib.resources.read_binary`
1646+
* :func:`importlib.resources.read_text`
1647+
* :func:`importlib.resources.path`
1648+
16201649
* The :func:`locale.getdefaultlocale` function is deprecated and will be
16211650
removed in Python 3.13. Use :func:`locale.setlocale`,
16221651
:func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>` and
@@ -1627,61 +1656,58 @@ Deprecated C APIs are :ref:`listed separately <whatsnew311-c-api-deprecated>`.
16271656
removed in Python 3.13. Use ``locale.setlocale(locale.LC_ALL, "")`` instead.
16281657
(Contributed by Victor Stinner in :gh:`90817`.)
16291658

1630-
.. _whatsnew311-pep594:
1631-
1632-
* :pep:`594` led to the deprecations of the following modules which are
1633-
slated for removal in Python 3.13:
1634-
1635-
* :mod:`aifc`
1636-
* :mod:`audioop`
1637-
* :mod:`cgi`
1638-
* :mod:`cgitb`
1639-
* :mod:`chunk`
1640-
* :mod:`crypt`
1641-
* :mod:`imghdr`
1642-
* :mod:`mailcap`
1643-
* :mod:`msilib`
1644-
* :mod:`nis`
1645-
* :mod:`nntplib`
1646-
* :mod:`ossaudiodev`
1647-
* :mod:`pipes`
1648-
* :mod:`sndhdr`
1649-
* :mod:`spwd`
1650-
* :mod:`sunau`
1651-
* :mod:`telnetlib`
1652-
* :mod:`uu`
1653-
* :mod:`xdrlib`
1654-
1655-
(Contributed by Brett Cannon in :issue:`47061` and Victor Stinner in
1656-
:gh:`68966`.)
1659+
* Stricter rules will now be applied for numerical group references
1660+
and group names in :ref:`regular expressions <re-syntax>`.
1661+
Only sequences of ASCII digits will now be accepted as a numerical reference,
1662+
and the group name in :class:`bytes` patterns and replacement strings
1663+
can only contain ASCII letters, digits and underscores.
1664+
For now, a deprecation warning is raised for syntax violating these rules.
1665+
(Contributed by Serhiy Storchaka in :gh:`91760`.)
16571666

1658-
* The :mod:`asynchat`, :mod:`asyncore` and :mod:`smtpd` modules have been
1659-
deprecated since at least Python 3.6. Their documentation and deprecation
1660-
warnings have now been updated to note they will removed in Python 3.12.
1661-
(Contributed by Hugo van Kemenade in :issue:`47022`.)
1667+
* In the :mod:`re` module, the :func:`!re.template` function
1668+
and the corresponding :data:`!re.TEMPLATE` and :data:`!re.T` flags
1669+
are deprecated, as they were undocumented and lacked an obvious purpose.
1670+
They will be removed in Python 3.13.
1671+
(Contributed by Serhiy Storchaka and Miro Hrončok in :gh:`92728`.)
16621672

1663-
* More strict rules will be applied now applied for numerical group references
1664-
and group names in regular expressions in future Python versions.
1665-
Only sequence of ASCII digits will be now accepted as a numerical reference.
1666-
The group name in bytes patterns and replacement strings could only
1667-
contain ASCII letters and digits and underscore.
1668-
For now, a deprecation warning is raised for such syntax.
1669-
(Contributed by Serhiy Storchaka in :gh:`91760`.)
1673+
* :func:`turtle.settiltangle` has been deprecated since Python 3.1;
1674+
it now emits a deprecation warning and will be removed in Python 3.13. Use
1675+
:func:`turtle.tiltangle` instead (it was earlier incorrectly marked
1676+
as deprecated, and its docstring is now corrected).
1677+
(Contributed by Hugo van Kemenade in :issue:`45837`.)
16701678

16711679
* :class:`typing.Text`, which exists solely to provide compatibility support
16721680
between Python 2 and Python 3 code, is now deprecated. Its removal is
16731681
currently unplanned, but users are encouraged to use :class:`str` instead
16741682
wherever possible.
16751683
(Contributed by Alex Waygood in :gh:`92332`.)
16761684

1677-
* The keyword argument syntax for constructing :data:`~typing.TypedDict` types
1685+
* The keyword argument syntax for constructing :data:`typing.TypedDict` types
16781686
is now deprecated. Support will be removed in Python 3.13. (Contributed by
16791687
Jingchen Ye in :gh:`90224`.)
16801688

1681-
* The :func:`re.template` function and the corresponding :const:`re.TEMPLATE`
1682-
and :const:`re.T` flags are deprecated, as they were undocumented and
1683-
lacked an obvious purpose. They will be removed in Python 3.13.
1684-
(Contributed by Serhiy Storchaka and Miro Hrončok in :gh:`92728`.)
1689+
* :class:`!webbrowser.MacOSX` is deprecated and will be removed in Python 3.13.
1690+
It is untested, undocumented, and not used by :mod:`webbrowser` itself.
1691+
(Contributed by Dong-hee Na in :issue:`42255`.)
1692+
1693+
* The behavior of returning a value from a :class:`~unittest.TestCase` and
1694+
:class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the
1695+
default ``None`` value) is now deprecated.
1696+
1697+
* Deprecated the following not-formally-documented :mod:`unittest` functions,
1698+
scheduled for removal in Python 3.13:
1699+
1700+
* :func:`!unittest.findTestCases`
1701+
* :func:`!unittest.makeSuite`
1702+
* :func:`!unittest.getTestCaseNames`
1703+
1704+
Use :class:`~unittest.TestLoader` methods instead:
1705+
1706+
* :meth:`unittest.TestLoader.loadTestsFromModule`
1707+
* :meth:`unittest.TestLoader.loadTestsFromTestCase`
1708+
* :meth:`unittest.TestLoader.getTestCaseNames`
1709+
1710+
(Contributed by Erlend E. Aasland in :issue:`5846`.)
16851711

16861712

16871713
.. _whatsnew311-pending-removal:

0 commit comments

Comments
 (0)