Skip to content

Commit 159ea47

Browse files
authored
[3.13] Docs: move deprecations into include files (GH-121241) (#122038)
1 parent a6c1081 commit 159ea47

File tree

5 files changed

+312
-309
lines changed

5 files changed

+312
-309
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
Pending Removal in Python 3.14
2+
------------------------------
3+
4+
* :mod:`argparse`: The *type*, *choices*, and *metavar* parameters
5+
of :class:`!argparse.BooleanOptionalAction` are deprecated
6+
and will be removed in 3.14.
7+
(Contributed by Nikita Sobolev in :gh:`92248`.)
8+
9+
* :mod:`ast`: The following features have been deprecated in documentation
10+
since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at
11+
runtime when they are accessed or used, and will be removed in Python 3.14:
12+
13+
* :class:`!ast.Num`
14+
* :class:`!ast.Str`
15+
* :class:`!ast.Bytes`
16+
* :class:`!ast.NameConstant`
17+
* :class:`!ast.Ellipsis`
18+
19+
Use :class:`ast.Constant` instead.
20+
(Contributed by Serhiy Storchaka in :gh:`90953`.)
21+
22+
* :mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`.
23+
Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`.
24+
For use in typing, prefer a union, like ``bytes | bytearray``,
25+
or :class:`collections.abc.Buffer`.
26+
(Contributed by Shantanu Jain in :gh:`91896`.)
27+
28+
* :mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils.localtime`.
29+
(Contributed by Alan Williams in :gh:`72346`.)
30+
31+
* :mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or
32+
taken into consideration by the import system (:gh:`97879`).
33+
34+
* :mod:`importlib.abc` deprecated classes:
35+
36+
* :class:`!importlib.abc.ResourceReader`
37+
* :class:`!importlib.abc.Traversable`
38+
* :class:`!importlib.abc.TraversableResources`
39+
40+
Use :mod:`importlib.resources.abc` classes instead:
41+
42+
* :class:`importlib.resources.abc.Traversable`
43+
* :class:`importlib.resources.abc.TraversableResources`
44+
45+
(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)
46+
47+
* :mod:`itertools` had undocumented, inefficient, historically buggy,
48+
and inconsistent support for copy, deepcopy, and pickle operations.
49+
This will be removed in 3.14 for a significant reduction in code
50+
volume and maintenance burden.
51+
(Contributed by Raymond Hettinger in :gh:`101588`.)
52+
53+
* :mod:`multiprocessing`: The default start method will change to a safer one on
54+
Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is currently
55+
the default (:gh:`84559`). Adding a runtime warning about this was deemed too
56+
disruptive as the majority of code is not expected to care. Use the
57+
:func:`~multiprocessing.get_context` or
58+
:func:`~multiprocessing.set_start_method` APIs to explicitly specify when
59+
your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`.
60+
61+
* :mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and
62+
:meth:`~pathlib.PurePath.relative_to`: passing additional arguments is
63+
deprecated.
64+
65+
* :mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader`
66+
now raise :exc:`DeprecationWarning`;
67+
use :func:`importlib.util.find_spec` instead.
68+
(Contributed by Nikita Sobolev in :gh:`97850`.)
69+
70+
* :mod:`pty`:
71+
72+
* ``master_open()``: use :func:`pty.openpty`.
73+
* ``slave_open()``: use :func:`pty.openpty`.
74+
75+
* :mod:`sqlite3`:
76+
77+
* :data:`~sqlite3.version` and :data:`~sqlite3.version_info`.
78+
79+
* :meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany`
80+
if :ref:`named placeholders <sqlite3-placeholders>` are used and
81+
*parameters* is a sequence instead of a :class:`dict`.
82+
83+
* date and datetime adapter, date and timestamp converter:
84+
see the :mod:`sqlite3` documentation for suggested replacement recipes.
85+
86+
* :class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was
87+
deprecated in :pep:`626`
88+
since 3.10 and was planned to be removed in 3.12,
89+
but it only got a proper :exc:`DeprecationWarning` in 3.12.
90+
May be removed in 3.14.
91+
(Contributed by Nikita Sobolev in :gh:`101866`.)
92+
93+
* :mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9,
94+
now causes a :exc:`DeprecationWarning` to be emitted when it is used.
95+
96+
* :mod:`urllib`:
97+
:class:`!urllib.parse.Quoter` is deprecated: it was not intended to be a
98+
public API.
99+
(Contributed by Gregory P. Smith in :gh:`88168`.)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
Pending Removal in Python 3.15
2+
------------------------------
3+
4+
* :class:`http.server.CGIHTTPRequestHandler` will be removed along with its
5+
related ``--cgi`` flag to ``python -m http.server``. It was obsolete and
6+
rarely used. No direct replacement exists. *Anything* is better than CGI
7+
to interface a web server with a request handler.
8+
9+
* :class:`locale`: :func:`locale.getdefaultlocale` was deprecated in Python 3.11
10+
and originally planned for removal in Python 3.13 (:gh:`90817`),
11+
but removal has been postponed to Python 3.15.
12+
Use :func:`locale.setlocale()`, :func:`locale.getencoding()` and
13+
:func:`locale.getlocale()` instead.
14+
(Contributed by Hugo van Kemenade in :gh:`111187`.)
15+
16+
* :mod:`pathlib`:
17+
:meth:`pathlib.PurePath.is_reserved` is deprecated and scheduled for
18+
removal in Python 3.15. Use :func:`os.path.isreserved` to detect reserved
19+
paths on Windows.
20+
21+
* :mod:`platform`:
22+
:func:`~platform.java_ver` is deprecated and will be removed in 3.15.
23+
It was largely untested, had a confusing API,
24+
and was only useful for Jython support.
25+
(Contributed by Nikita Sobolev in :gh:`116349`.)
26+
27+
* :mod:`threading`:
28+
Passing any arguments to :func:`threading.RLock` is now deprecated.
29+
C version allows any numbers of args and kwargs,
30+
but they are just ignored. Python version does not allow any arguments.
31+
All arguments will be removed from :func:`threading.RLock` in Python 3.15.
32+
(Contributed by Nikita Sobolev in :gh:`102029`.)
33+
34+
* :class:`typing.NamedTuple`:
35+
36+
* The undocumented keyword argument syntax for creating :class:`!NamedTuple` classes
37+
(``NT = NamedTuple("NT", x=int)``) is deprecated, and will be disallowed in
38+
3.15. Use the class-based syntax or the functional syntax instead.
39+
40+
* When using the functional syntax to create a :class:`!NamedTuple` class, failing to
41+
pass a value to the *fields* parameter (``NT = NamedTuple("NT")``) is
42+
deprecated. Passing ``None`` to the *fields* parameter
43+
(``NT = NamedTuple("NT", None)``) is also deprecated. Both will be
44+
disallowed in Python 3.15. To create a :class:`!NamedTuple` class with 0 fields, use
45+
``class NT(NamedTuple): pass`` or ``NT = NamedTuple("NT", [])``.
46+
47+
* :class:`typing.TypedDict`: When using the functional syntax to create a
48+
:class:`!TypedDict` class, failing to pass a value to the *fields* parameter (``TD =
49+
TypedDict("TD")``) is deprecated. Passing ``None`` to the *fields* parameter
50+
(``TD = TypedDict("TD", None)``) is also deprecated. Both will be disallowed
51+
in Python 3.15. To create a :class:`!TypedDict` class with 0 fields, use ``class
52+
TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})``.
53+
54+
* :mod:`wave`: Deprecate the ``getmark()``, ``setmark()`` and ``getmarkers()``
55+
methods of the :class:`wave.Wave_read` and :class:`wave.Wave_write` classes.
56+
They will be removed in Python 3.15.
57+
(Contributed by Victor Stinner in :gh:`105096`.)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Pending Removal in Python 3.16
2+
------------------------------
3+
4+
* :class:`array.array` ``'u'`` type (:c:type:`wchar_t`):
5+
use the ``'w'`` type instead (``Py_UCS4``).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
Pending Removal in Future Versions
2+
----------------------------------
3+
4+
The following APIs will be removed in the future,
5+
although there is currently no date scheduled for their removal.
6+
7+
* :mod:`argparse`: Nesting argument groups and nesting mutually exclusive
8+
groups are deprecated.
9+
10+
* :mod:`builtins`:
11+
12+
* ``~bool``, bitwise inversion on bool.
13+
* ``bool(NotImplemented)``.
14+
* Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)``
15+
signature is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead,
16+
the single argument signature.
17+
* Currently Python accepts numeric literals immediately followed by keywords,
18+
for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and
19+
ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as
20+
``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised
21+
if the numeric literal is immediately followed by one of keywords
22+
:keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`,
23+
:keyword:`in`, :keyword:`is` and :keyword:`or`. In a future release it
24+
will be changed to a syntax error. (:gh:`87999`)
25+
* Support for ``__index__()`` and ``__int__()`` method returning non-int type:
26+
these methods will be required to return an instance of a strict subclass of
27+
:class:`int`.
28+
* Support for ``__float__()`` method returning a strict subclass of
29+
:class:`float`: these methods will be required to return an instance of
30+
:class:`float`.
31+
* Support for ``__complex__()`` method returning a strict subclass of
32+
:class:`complex`: these methods will be required to return an instance of
33+
:class:`complex`.
34+
* Delegation of ``int()`` to ``__trunc__()`` method.
35+
36+
* :mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants are
37+
deprecated and replaced by :data:`calendar.JANUARY` and
38+
:data:`calendar.FEBRUARY`.
39+
(Contributed by Prince Roshan in :gh:`103636`.)
40+
41+
* :attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method
42+
instead.
43+
44+
* :mod:`datetime`:
45+
46+
* :meth:`~datetime.datetime.utcnow`:
47+
use ``datetime.datetime.now(tz=datetime.UTC)``.
48+
* :meth:`~datetime.datetime.utcfromtimestamp`:
49+
use ``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``.
50+
51+
* :mod:`gettext`: Plural value must be an integer.
52+
53+
* :mod:`importlib`:
54+
55+
* ``load_module()`` method: use ``exec_module()`` instead.
56+
* :func:`~importlib.util.cache_from_source` *debug_override* parameter is
57+
deprecated: use the *optimization* parameter instead.
58+
59+
* :mod:`importlib.metadata`:
60+
61+
* ``EntryPoints`` tuple interface.
62+
* Implicit ``None`` on return values.
63+
64+
* :mod:`mailbox`: Use of StringIO input and text mode is deprecated, use
65+
BytesIO and binary mode instead.
66+
67+
* :mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process.
68+
69+
* :class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is
70+
deprecated, use an exception instance.
71+
72+
* :mod:`re`: More strict rules are now applied for numerical group references
73+
and group names in regular expressions. Only sequence of ASCII digits is now
74+
accepted as a numerical reference. The group name in bytes patterns and
75+
replacement strings can now only contain ASCII letters and digits and
76+
underscore.
77+
(Contributed by Serhiy Storchaka in :gh:`91760`.)
78+
79+
* :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
80+
81+
* :mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in
82+
Python 3.12; use the *onexc* parameter instead.
83+
84+
* :mod:`ssl` options and protocols:
85+
86+
* :class:`ssl.SSLContext` without protocol argument is deprecated.
87+
* :class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and
88+
:meth:`!selected_npn_protocol` are deprecated: use ALPN
89+
instead.
90+
* ``ssl.OP_NO_SSL*`` options
91+
* ``ssl.OP_NO_TLS*`` options
92+
* ``ssl.PROTOCOL_SSLv3``
93+
* ``ssl.PROTOCOL_TLS``
94+
* ``ssl.PROTOCOL_TLSv1``
95+
* ``ssl.PROTOCOL_TLSv1_1``
96+
* ``ssl.PROTOCOL_TLSv1_2``
97+
* ``ssl.TLSVersion.SSLv3``
98+
* ``ssl.TLSVersion.TLSv1``
99+
* ``ssl.TLSVersion.TLSv1_1``
100+
101+
* :func:`sysconfig.is_python_build` *check_home* parameter is deprecated and
102+
ignored.
103+
104+
* :mod:`threading` methods:
105+
106+
* :meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition.notify_all`.
107+
* :meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`.
108+
* :meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`:
109+
use :attr:`threading.Thread.daemon` attribute.
110+
* :meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`:
111+
use :attr:`threading.Thread.name` attribute.
112+
* :meth:`!threading.currentThread`: use :meth:`threading.current_thread`.
113+
* :meth:`!threading.activeCount`: use :meth:`threading.active_count`.
114+
115+
* :class:`typing.Text` (:gh:`92332`).
116+
117+
* :class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a value
118+
that is not ``None`` from a test case.
119+
120+
* :mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` instead
121+
122+
* ``splitattr()``
123+
* ``splithost()``
124+
* ``splitnport()``
125+
* ``splitpasswd()``
126+
* ``splitport()``
127+
* ``splitquery()``
128+
* ``splittag()``
129+
* ``splittype()``
130+
* ``splituser()``
131+
* ``splitvalue()``
132+
* ``to_bytes()``
133+
134+
* :mod:`urllib.request`: :class:`~urllib.request.URLopener` and
135+
:class:`~urllib.request.FancyURLopener` style of invoking requests is
136+
deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods.
137+
138+
* :mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial
139+
writes.
140+
141+
* :mod:`xml.etree.ElementTree`: Testing the truth value of an
142+
:class:`~xml.etree.ElementTree.Element` is deprecated. In a future release it
143+
will always return ``True``. Prefer explicit ``len(elem)`` or
144+
``elem is not None`` tests instead.
145+
146+
* :meth:`zipimport.zipimporter.load_module` is deprecated:
147+
use :meth:`~zipimport.zipimporter.exec_module` instead.

0 commit comments

Comments
 (0)