Skip to content

Commit

Permalink
Docs: move deprecations into include files
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Jul 5, 2024
1 parent db39bc4 commit 2e85df9
Show file tree
Hide file tree
Showing 5 changed files with 312 additions and 309 deletions.
99 changes: 99 additions & 0 deletions Doc/deprecations/pending-removal-in-3.14.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
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:`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:`!version` and :data:`!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`.)
57 changes: 57 additions & 0 deletions Doc/deprecations/pending-removal-in-3.15.rst
Original file line number Diff line number Diff line change
@@ -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. Use :func:`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`.)
5 changes: 5 additions & 0 deletions Doc/deprecations/pending-removal-in-3.16.rst
Original file line number Diff line number Diff line change
@@ -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``).
147 changes: 147 additions & 0 deletions Doc/deprecations/pending-removal-in-future.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
Pending Removal in Future Versions
----------------------------------

The following APIs were 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:`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
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.
Loading

0 comments on commit 2e85df9

Please sign in to comment.