[3.12] gh-122085: Use include files for whatsnew/3.12.rst deprecations (GH-122093) (#122224)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
Hugo van Kemenade 2024-07-24 19:41:57 +03:00 committed by GitHub
parent f8ddebbd44
commit 1a104e5112
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 386 additions and 142 deletions

View file

@ -0,0 +1,52 @@
Pending Removal in Python 3.13
------------------------------
Modules (see :pep:`594`):
* :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`
* :mod:`xdrlib`
Other modules:
* :mod:`!lib2to3`, and the :program:`2to3` program (:gh:`84540`)
APIs:
* :class:`!configparser.LegacyInterpolation` (:gh:`90765`)
* ``locale.resetlocale()`` (:gh:`90817`)
* :meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)
* :func:`!unittest.findTestCases` (:gh:`50096`)
* :func:`!unittest.getTestCaseNames` (:gh:`50096`)
* :func:`!unittest.makeSuite` (:gh:`50096`)
* :meth:`!unittest.TestProgram.usageExit` (:gh:`67048`)
* :class:`!webbrowser.MacOSX` (:gh:`86421`)
* :class:`classmethod` descriptor chaining (:gh:`89519`)
* :mod:`importlib.resources` deprecated methods:
* ``contents()``
* ``is_resource()``
* ``open_binary()``
* ``open_text()``
* ``path()``
* ``read_binary()``
* ``read_text()``
Use :func:`importlib.resources.files()` instead. Refer to `importlib-resources: Migrating from Legacy
<https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy>`_ (:gh:`106531`)

View file

@ -0,0 +1,118 @@
Pending Removal in Python 3.14
------------------------------
* :mod:`argparse`: The *type*, *choices*, and *metavar* parameters
of :class:`!argparse.BooleanOptionalAction` are deprecated
and will be removed in 3.14.
(Contributed by Nikita Sobolev in :gh:`92248`.)
* :mod:`ast`: The following features have been deprecated in documentation
since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at
runtime when they are accessed or used, and will be removed in Python 3.14:
* :class:`!ast.Num`
* :class:`!ast.Str`
* :class:`!ast.Bytes`
* :class:`!ast.NameConstant`
* :class:`!ast.Ellipsis`
Use :class:`ast.Constant` instead.
(Contributed by Serhiy Storchaka in :gh:`90953`.)
* :mod:`asyncio`:
* The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`,
:class:`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher`
and :class:`~asyncio.SafeChildWatcher` are deprecated and
will be removed in Python 3.14.
(Contributed by Kumar Aditya in :gh:`94597`.)
* :func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`,
:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` and
:meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated
and will be removed in Python 3.14.
(Contributed by Kumar Aditya in :gh:`94597`.)
* The :meth:`~asyncio.get_event_loop` method of the
default event loop policy now emits a :exc:`DeprecationWarning` if there
is no current event loop set and it decides to create one.
(Contributed by Serhiy Storchaka and Guido van Rossum in :gh:`100160`.)
* :mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`.
Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`.
For use in typing, prefer a union, like ``bytes | bytearray``,
or :class:`collections.abc.Buffer`.
(Contributed by Shantanu Jain in :gh:`91896`.)
* :mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils.localtime`.
(Contributed by Alan Williams in :gh:`72346`.)
* :mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or
taken into consideration by the import system (:gh:`97879`).
* :mod:`importlib.abc` deprecated classes:
* :class:`!importlib.abc.ResourceReader`
* :class:`!importlib.abc.Traversable`
* :class:`!importlib.abc.TraversableResources`
Use :mod:`importlib.resources.abc` classes instead:
* :class:`importlib.resources.abc.Traversable`
* :class:`importlib.resources.abc.TraversableResources`
(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)
* :mod:`itertools` had undocumented, inefficient, historically buggy,
and inconsistent support for copy, deepcopy, and pickle operations.
This will be removed in 3.14 for a significant reduction in code
volume and maintenance burden.
(Contributed by Raymond Hettinger in :gh:`101588`.)
* :mod:`multiprocessing`: The default start method will change to a safer one on
Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is currently
the default (:gh:`84559`). Adding a runtime warning about this was deemed too
disruptive as the majority of code is not expected to care. Use the
:func:`~multiprocessing.get_context` or
:func:`~multiprocessing.set_start_method` APIs to explicitly specify when
your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`.
* :mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and
:meth:`~pathlib.PurePath.relative_to`: passing additional arguments is
deprecated.
* :mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader`
now raise :exc:`DeprecationWarning`;
use :func:`importlib.util.find_spec` instead.
(Contributed by Nikita Sobolev in :gh:`97850`.)
* :mod:`pty`:
* ``master_open()``: use :func:`pty.openpty`.
* ``slave_open()``: use :func:`pty.openpty`.
* :mod:`sqlite3`:
* :data:`~sqlite3.version` and :data:`~sqlite3.version_info`.
* :meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany`
if :ref:`named placeholders <sqlite3-placeholders>` are used and
*parameters* is a sequence instead of a :class:`dict`.
* date and datetime adapter, date and timestamp converter:
see the :mod:`sqlite3` documentation for suggested replacement recipes.
* :class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was
deprecated in :pep:`626`
since 3.10 and was planned to be removed in 3.12,
but it only got a proper :exc:`DeprecationWarning` in 3.12.
May be removed in 3.14.
(Contributed by Nikita Sobolev in :gh:`101866`.)
* :mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9,
now causes a :exc:`DeprecationWarning` to be emitted when it is used.
* :mod:`urllib`:
:class:`!urllib.parse.Quoter` is deprecated: it was not intended to be a
public API.
(Contributed by Gregory P. Smith in :gh:`88168`.)

View file

@ -0,0 +1,57 @@
Pending Removal in Python 3.15
------------------------------
* :class:`http.server.CGIHTTPRequestHandler` will be removed along with its
related ``--cgi`` flag to ``python -m http.server``. It was obsolete and
rarely used. No direct replacement exists. *Anything* is better than CGI
to interface a web server with a request handler.
* :class:`locale`: :func:`locale.getdefaultlocale` was deprecated in Python 3.11
and originally planned for removal in Python 3.13 (:gh:`90817`),
but removal has been postponed to Python 3.15.
Use :func:`locale.setlocale()`, :func:`locale.getencoding()` and
:func:`locale.getlocale()` instead.
(Contributed by Hugo van Kemenade in :gh:`111187`.)
* :mod:`pathlib`:
:meth:`pathlib.PurePath.is_reserved` is deprecated and scheduled for
removal in Python 3.15. From Python 3.13 onwards, use ``os.path.isreserved``
to detect reserved paths on Windows.
* :mod:`platform`:
:func:`~platform.java_ver` is deprecated and will be removed in 3.15.
It was largely untested, had a confusing API,
and was only useful for Jython support.
(Contributed by Nikita Sobolev in :gh:`116349`.)
* :mod:`threading`:
Passing any arguments to :func:`threading.RLock` is now deprecated.
C version allows any numbers of args and kwargs,
but they are just ignored. Python version does not allow any arguments.
All arguments will be removed from :func:`threading.RLock` in Python 3.15.
(Contributed by Nikita Sobolev in :gh:`102029`.)
* :class:`typing.NamedTuple`:
* The undocumented keyword argument syntax for creating :class:`!NamedTuple` classes
(``NT = NamedTuple("NT", x=int)``) is deprecated, and will be disallowed in
3.15. Use the class-based syntax or the functional syntax instead.
* When using the functional syntax to create a :class:`!NamedTuple` class, failing to
pass a value to the *fields* parameter (``NT = NamedTuple("NT")``) is
deprecated. Passing ``None`` to the *fields* parameter
(``NT = NamedTuple("NT", None)``) is also deprecated. Both will be
disallowed in Python 3.15. To create a :class:`!NamedTuple` class with 0 fields, use
``class NT(NamedTuple): pass`` or ``NT = NamedTuple("NT", [])``.
* :class:`typing.TypedDict`: When using the functional syntax to create a
:class:`!TypedDict` class, failing to pass a value to the *fields* parameter (``TD =
TypedDict("TD")``) is deprecated. Passing ``None`` to the *fields* parameter
(``TD = TypedDict("TD", None)``) is also deprecated. Both will be disallowed
in Python 3.15. To create a :class:`!TypedDict` class with 0 fields, use ``class
TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})``.
* :mod:`wave`: Deprecate the ``getmark()``, ``setmark()`` and ``getmarkers()``
methods of the :class:`wave.Wave_read` and :class:`wave.Wave_write` classes.
They will be removed in Python 3.15.
(Contributed by Victor Stinner in :gh:`105096`.)

View file

@ -0,0 +1,5 @@
Pending Removal in Python 3.16
------------------------------
* :class:`array.array` ``'u'`` type (:c:type:`wchar_t`):
use the ``'w'`` type instead (``Py_UCS4``).

View file

@ -0,0 +1,149 @@
Pending Removal in Future Versions
----------------------------------
The following APIs will be removed in the future,
although there is currently no date scheduled for their removal.
* :mod:`argparse`: Nesting argument groups and nesting mutually exclusive
groups are deprecated.
* :mod:`array`'s ``'u'`` format code (:gh:`57281`)
* :mod:`builtins`:
* ``~bool``, bitwise inversion on bool.
* ``bool(NotImplemented)``.
* Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)``
signature is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead,
the single argument signature.
* Currently Python accepts numeric literals immediately followed by keywords,
for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and
ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as
``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised
if the numeric literal is immediately followed by one of keywords
:keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`,
:keyword:`in`, :keyword:`is` and :keyword:`or`. In a future release it
will be changed to a syntax error. (:gh:`87999`)
* Support for ``__index__()`` and ``__int__()`` method returning non-int type:
these methods will be required to return an instance of a strict subclass of
:class:`int`.
* Support for ``__float__()`` method returning a strict subclass of
:class:`float`: these methods will be required to return an instance of
:class:`float`.
* Support for ``__complex__()`` method returning a strict subclass of
:class:`complex`: these methods will be required to return an instance of
:class:`complex`.
* Delegation of ``int()`` to ``__trunc__()`` method.
* :mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants are
deprecated and replaced by :data:`calendar.JANUARY` and
:data:`calendar.FEBRUARY`.
(Contributed by Prince Roshan in :gh:`103636`.)
* :attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method
instead.
* :mod:`datetime`:
* :meth:`~datetime.datetime.utcnow`:
use ``datetime.datetime.now(tz=datetime.UTC)``.
* :meth:`~datetime.datetime.utcfromtimestamp`:
use ``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``.
* :mod:`gettext`: Plural value must be an integer.
* :mod:`importlib`:
* ``load_module()`` method: use ``exec_module()`` instead.
* :func:`~importlib.util.cache_from_source` *debug_override* parameter is
deprecated: use the *optimization* parameter instead.
* :mod:`importlib.metadata`:
* ``EntryPoints`` tuple interface.
* Implicit ``None`` on return values.
* :mod:`mailbox`: Use of StringIO input and text mode is deprecated, use
BytesIO and binary mode instead.
* :mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process.
* :class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is
deprecated, use an exception instance.
* :mod:`re`: More strict rules are now applied for numerical group references
and group names in regular expressions. Only sequence of ASCII digits is now
accepted as a numerical reference. The group name in bytes patterns and
replacement strings can now only contain ASCII letters and digits and
underscore.
(Contributed by Serhiy Storchaka in :gh:`91760`.)
* :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
* :mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in
Python 3.12; use the *onexc* parameter instead.
* :mod:`ssl` options and protocols:
* :class:`ssl.SSLContext` without protocol argument is deprecated.
* :class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and
:meth:`!selected_npn_protocol` are deprecated: use ALPN
instead.
* ``ssl.OP_NO_SSL*`` options
* ``ssl.OP_NO_TLS*`` options
* ``ssl.PROTOCOL_SSLv3``
* ``ssl.PROTOCOL_TLS``
* ``ssl.PROTOCOL_TLSv1``
* ``ssl.PROTOCOL_TLSv1_1``
* ``ssl.PROTOCOL_TLSv1_2``
* ``ssl.TLSVersion.SSLv3``
* ``ssl.TLSVersion.TLSv1``
* ``ssl.TLSVersion.TLSv1_1``
* :func:`sysconfig.is_python_build` *check_home* parameter is deprecated and
ignored.
* :mod:`threading` methods:
* :meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition.notify_all`.
* :meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`.
* :meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`:
use :attr:`threading.Thread.daemon` attribute.
* :meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`:
use :attr:`threading.Thread.name` attribute.
* :meth:`!threading.currentThread`: use :meth:`threading.current_thread`.
* :meth:`!threading.activeCount`: use :meth:`threading.active_count`.
* :class:`typing.Text` (:gh:`92332`).
* :class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a value
that is not ``None`` from a test case.
* :mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` instead
* ``splitattr()``
* ``splithost()``
* ``splitnport()``
* ``splitpasswd()``
* ``splitport()``
* ``splitquery()``
* ``splittag()``
* ``splittype()``
* ``splituser()``
* ``splitvalue()``
* ``to_bytes()``
* :mod:`urllib.request`: :class:`~urllib.request.URLopener` and
:class:`~urllib.request.FancyURLopener` style of invoking requests is
deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods.
* :mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial
writes.
* :mod:`xml.etree.ElementTree`: Testing the truth value of an
:class:`~xml.etree.ElementTree.Element` is deprecated. In a future release it
will always return ``True``. Prefer explicit ``len(elem)`` or
``elem is not None`` tests instead.
* :meth:`zipimport.zipimporter.load_module` is deprecated:
use :meth:`~zipimport.zipimporter.exec_module` instead.

View file

@ -1341,152 +1341,15 @@ Deprecated
therefore it will be removed in 3.14.
(Contributed by Nikita Sobolev in :gh:`101866`.)
Pending Removal in Python 3.13
------------------------------
.. include:: ../deprecations/pending-removal-in-3.13.rst
The following modules and APIs have been deprecated in earlier Python releases,
and will be removed in Python 3.13.
.. include:: ../deprecations/pending-removal-in-3.14.rst
Modules (see :pep:`594`):
.. include:: ../deprecations/pending-removal-in-3.15.rst
* :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`
* :mod:`xdrlib`
Other modules:
* :mod:`!lib2to3`, and the :program:`2to3` program (:gh:`84540`)
APIs:
* :class:`!configparser.LegacyInterpolation` (:gh:`90765`)
* ``locale.resetlocale()`` (:gh:`90817`)
* :meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)
* :func:`!unittest.findTestCases` (:gh:`50096`)
* :func:`!unittest.getTestCaseNames` (:gh:`50096`)
* :func:`!unittest.makeSuite` (:gh:`50096`)
* :meth:`!unittest.TestProgram.usageExit` (:gh:`67048`)
* :class:`!webbrowser.MacOSX` (:gh:`86421`)
* :class:`classmethod` descriptor chaining (:gh:`89519`)
* :mod:`importlib.resources` deprecated methods:
* ``contents()``
* ``is_resource()``
* ``open_binary()``
* ``open_text()``
* ``path()``
* ``read_binary()``
* ``read_text()``
Use :func:`importlib.resources.files()` instead. Refer to `importlib-resources: Migrating from Legacy
<https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy>`_ (:gh:`106531`)
Pending Removal in Python 3.14
------------------------------
The following APIs have been deprecated
and will be removed in Python 3.14.
* :mod:`argparse`: The *type*, *choices*, and *metavar* parameters
of :class:`!argparse.BooleanOptionalAction`
* :mod:`ast`:
* :class:`!ast.Num`
* :class:`!ast.Str`
* :class:`!ast.Bytes`
* :class:`!ast.NameConstant`
* :class:`!ast.Ellipsis`
* :mod:`asyncio`:
* :class:`!asyncio.MultiLoopChildWatcher`
* :class:`!asyncio.FastChildWatcher`
* :class:`!asyncio.AbstractChildWatcher`
* :class:`!asyncio.SafeChildWatcher`
* :func:`!asyncio.set_child_watcher`
* :func:`!asyncio.get_child_watcher`,
* :meth:`!asyncio.AbstractEventLoopPolicy.set_child_watcher`
* :meth:`!asyncio.AbstractEventLoopPolicy.get_child_watcher`
* :mod:`collections.abc`: :class:`!collections.abc.ByteString`.
* :mod:`email`: the *isdst* parameter in :func:`email.utils.localtime`.
* :mod:`importlib.abc`:
* :class:`!importlib.abc.ResourceReader`
* :class:`!importlib.abc.Traversable`
* :class:`!importlib.abc.TraversableResources`
* :mod:`itertools`: Support for copy, deepcopy, and pickle operations.
* :mod:`pkgutil`:
* :func:`!pkgutil.find_loader`
* :func:`!pkgutil.get_loader`.
* :mod:`pty`:
* :func:`!pty.master_open`
* :func:`!pty.slave_open`
* :mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree`
* :mod:`typing`: :class:`!typing.ByteString`
* :mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`xml.etree.ElementTree.Element`.
* The ``__package__`` and ``__cached__`` attributes on module objects.
* The :attr:`~codeobject.co_lnotab` attribute of code objects.
Pending Removal in Python 3.15
------------------------------
The following APIs have been deprecated
and will be removed in Python 3.15.
APIs:
* :func:`locale.getdefaultlocale` (:gh:`90817`)
Pending Removal in Future Versions
----------------------------------
The following APIs were deprecated in earlier Python versions and will be removed,
although there is currently no date scheduled for their removal.
* :mod:`array`'s ``'u'`` format code (:gh:`57281`)
* :class:`typing.Text` (:gh:`92332`)
* Currently Python accepts numeric literals immediately followed by keywords,
for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing
and ambiguous expressions like ``[0x1for x in y]`` (which can be
interpreted as ``[0x1 for x in y]`` or ``[0x1f or x in y]``).
A syntax warning is raised if the numeric literal is
immediately followed by one of keywords :keyword:`and`, :keyword:`else`,
:keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` and :keyword:`or`.
In a future release it will be changed to a syntax error. (:gh:`87999`)
.. include:: ../deprecations/pending-removal-in-3.16.rst
.. include:: ../deprecations/pending-removal-in-future.rst
Removed
=======