Skip to content

Commit aa9243e

Browse files
committed
[3.12] pythongh-122085: Use include files for whatsnew/3.12.rst deprecations (pythonGH-122093)
(cherry picked from commit b3b7b7d) Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 9dad694 commit aa9243e

6 files changed

+386
-142
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Pending Removal in Python 3.13
2+
------------------------------
3+
4+
Modules (see :pep:`594`):
5+
6+
* :mod:`aifc`
7+
* :mod:`audioop`
8+
* :mod:`cgi`
9+
* :mod:`cgitb`
10+
* :mod:`chunk`
11+
* :mod:`crypt`
12+
* :mod:`imghdr`
13+
* :mod:`mailcap`
14+
* :mod:`msilib`
15+
* :mod:`nis`
16+
* :mod:`nntplib`
17+
* :mod:`ossaudiodev`
18+
* :mod:`pipes`
19+
* :mod:`sndhdr`
20+
* :mod:`spwd`
21+
* :mod:`sunau`
22+
* :mod:`telnetlib`
23+
* :mod:`uu`
24+
* :mod:`xdrlib`
25+
26+
Other modules:
27+
28+
* :mod:`!lib2to3`, and the :program:`2to3` program (:gh:`84540`)
29+
30+
APIs:
31+
32+
* :class:`!configparser.LegacyInterpolation` (:gh:`90765`)
33+
* ``locale.resetlocale()`` (:gh:`90817`)
34+
* :meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)
35+
* :func:`!unittest.findTestCases` (:gh:`50096`)
36+
* :func:`!unittest.getTestCaseNames` (:gh:`50096`)
37+
* :func:`!unittest.makeSuite` (:gh:`50096`)
38+
* :meth:`!unittest.TestProgram.usageExit` (:gh:`67048`)
39+
* :class:`!webbrowser.MacOSX` (:gh:`86421`)
40+
* :class:`classmethod` descriptor chaining (:gh:`89519`)
41+
* :mod:`importlib.resources` deprecated methods:
42+
43+
* ``contents()``
44+
* ``is_resource()``
45+
* ``open_binary()``
46+
* ``open_text()``
47+
* ``path()``
48+
* ``read_binary()``
49+
* ``read_text()``
50+
51+
Use :func:`importlib.resources.files()` instead. Refer to `importlib-resources: Migrating from Legacy
52+
<https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy>`_ (:gh:`106531`)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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:`asyncio`:
23+
24+
* The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`,
25+
:class:`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher`
26+
and :class:`~asyncio.SafeChildWatcher` are deprecated and
27+
will be removed in Python 3.14.
28+
(Contributed by Kumar Aditya in :gh:`94597`.)
29+
30+
* :func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`,
31+
:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` and
32+
:meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated
33+
and will be removed in Python 3.14.
34+
(Contributed by Kumar Aditya in :gh:`94597`.)
35+
36+
* The :meth:`~asyncio.get_event_loop` method of the
37+
default event loop policy now emits a :exc:`DeprecationWarning` if there
38+
is no current event loop set and it decides to create one.
39+
(Contributed by Serhiy Storchaka and Guido van Rossum in :gh:`100160`.)
40+
41+
* :mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`.
42+
Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`.
43+
For use in typing, prefer a union, like ``bytes | bytearray``,
44+
or :class:`collections.abc.Buffer`.
45+
(Contributed by Shantanu Jain in :gh:`91896`.)
46+
47+
* :mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils.localtime`.
48+
(Contributed by Alan Williams in :gh:`72346`.)
49+
50+
* :mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or
51+
taken into consideration by the import system (:gh:`97879`).
52+
53+
* :mod:`importlib.abc` deprecated classes:
54+
55+
* :class:`!importlib.abc.ResourceReader`
56+
* :class:`!importlib.abc.Traversable`
57+
* :class:`!importlib.abc.TraversableResources`
58+
59+
Use :mod:`importlib.resources.abc` classes instead:
60+
61+
* :class:`importlib.resources.abc.Traversable`
62+
* :class:`importlib.resources.abc.TraversableResources`
63+
64+
(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)
65+
66+
* :mod:`itertools` had undocumented, inefficient, historically buggy,
67+
and inconsistent support for copy, deepcopy, and pickle operations.
68+
This will be removed in 3.14 for a significant reduction in code
69+
volume and maintenance burden.
70+
(Contributed by Raymond Hettinger in :gh:`101588`.)
71+
72+
* :mod:`multiprocessing`: The default start method will change to a safer one on
73+
Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is currently
74+
the default (:gh:`84559`). Adding a runtime warning about this was deemed too
75+
disruptive as the majority of code is not expected to care. Use the
76+
:func:`~multiprocessing.get_context` or
77+
:func:`~multiprocessing.set_start_method` APIs to explicitly specify when
78+
your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`.
79+
80+
* :mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and
81+
:meth:`~pathlib.PurePath.relative_to`: passing additional arguments is
82+
deprecated.
83+
84+
* :mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader`
85+
now raise :exc:`DeprecationWarning`;
86+
use :func:`importlib.util.find_spec` instead.
87+
(Contributed by Nikita Sobolev in :gh:`97850`.)
88+
89+
* :mod:`pty`:
90+
91+
* ``master_open()``: use :func:`pty.openpty`.
92+
* ``slave_open()``: use :func:`pty.openpty`.
93+
94+
* :mod:`sqlite3`:
95+
96+
* :data:`~sqlite3.version` and :data:`~sqlite3.version_info`.
97+
98+
* :meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany`
99+
if :ref:`named placeholders <sqlite3-placeholders>` are used and
100+
*parameters* is a sequence instead of a :class:`dict`.
101+
102+
* date and datetime adapter, date and timestamp converter:
103+
see the :mod:`sqlite3` documentation for suggested replacement recipes.
104+
105+
* :class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was
106+
deprecated in :pep:`626`
107+
since 3.10 and was planned to be removed in 3.12,
108+
but it only got a proper :exc:`DeprecationWarning` in 3.12.
109+
May be removed in 3.14.
110+
(Contributed by Nikita Sobolev in :gh:`101866`.)
111+
112+
* :mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9,
113+
now causes a :exc:`DeprecationWarning` to be emitted when it is used.
114+
115+
* :mod:`urllib`:
116+
:class:`!urllib.parse.Quoter` is deprecated: it was not intended to be a
117+
public API.
118+
(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,149 @@
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:`array`'s ``'u'`` format code (:gh:`57281`)
11+
12+
* :mod:`builtins`:
13+
14+
* ``~bool``, bitwise inversion on bool.
15+
* ``bool(NotImplemented)``.
16+
* Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)``
17+
signature is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead,
18+
the single argument signature.
19+
* Currently Python accepts numeric literals immediately followed by keywords,
20+
for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and
21+
ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as
22+
``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised
23+
if the numeric literal is immediately followed by one of keywords
24+
:keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`,
25+
:keyword:`in`, :keyword:`is` and :keyword:`or`. In a future release it
26+
will be changed to a syntax error. (:gh:`87999`)
27+
* Support for ``__index__()`` and ``__int__()`` method returning non-int type:
28+
these methods will be required to return an instance of a strict subclass of
29+
:class:`int`.
30+
* Support for ``__float__()`` method returning a strict subclass of
31+
:class:`float`: these methods will be required to return an instance of
32+
:class:`float`.
33+
* Support for ``__complex__()`` method returning a strict subclass of
34+
:class:`complex`: these methods will be required to return an instance of
35+
:class:`complex`.
36+
* Delegation of ``int()`` to ``__trunc__()`` method.
37+
38+
* :mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants are
39+
deprecated and replaced by :data:`calendar.JANUARY` and
40+
:data:`calendar.FEBRUARY`.
41+
(Contributed by Prince Roshan in :gh:`103636`.)
42+
43+
* :attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method
44+
instead.
45+
46+
* :mod:`datetime`:
47+
48+
* :meth:`~datetime.datetime.utcnow`:
49+
use ``datetime.datetime.now(tz=datetime.UTC)``.
50+
* :meth:`~datetime.datetime.utcfromtimestamp`:
51+
use ``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``.
52+
53+
* :mod:`gettext`: Plural value must be an integer.
54+
55+
* :mod:`importlib`:
56+
57+
* ``load_module()`` method: use ``exec_module()`` instead.
58+
* :func:`~importlib.util.cache_from_source` *debug_override* parameter is
59+
deprecated: use the *optimization* parameter instead.
60+
61+
* :mod:`importlib.metadata`:
62+
63+
* ``EntryPoints`` tuple interface.
64+
* Implicit ``None`` on return values.
65+
66+
* :mod:`mailbox`: Use of StringIO input and text mode is deprecated, use
67+
BytesIO and binary mode instead.
68+
69+
* :mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process.
70+
71+
* :class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is
72+
deprecated, use an exception instance.
73+
74+
* :mod:`re`: More strict rules are now applied for numerical group references
75+
and group names in regular expressions. Only sequence of ASCII digits is now
76+
accepted as a numerical reference. The group name in bytes patterns and
77+
replacement strings can now only contain ASCII letters and digits and
78+
underscore.
79+
(Contributed by Serhiy Storchaka in :gh:`91760`.)
80+
81+
* :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
82+
83+
* :mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in
84+
Python 3.12; use the *onexc* parameter instead.
85+
86+
* :mod:`ssl` options and protocols:
87+
88+
* :class:`ssl.SSLContext` without protocol argument is deprecated.
89+
* :class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and
90+
:meth:`!selected_npn_protocol` are deprecated: use ALPN
91+
instead.
92+
* ``ssl.OP_NO_SSL*`` options
93+
* ``ssl.OP_NO_TLS*`` options
94+
* ``ssl.PROTOCOL_SSLv3``
95+
* ``ssl.PROTOCOL_TLS``
96+
* ``ssl.PROTOCOL_TLSv1``
97+
* ``ssl.PROTOCOL_TLSv1_1``
98+
* ``ssl.PROTOCOL_TLSv1_2``
99+
* ``ssl.TLSVersion.SSLv3``
100+
* ``ssl.TLSVersion.TLSv1``
101+
* ``ssl.TLSVersion.TLSv1_1``
102+
103+
* :func:`sysconfig.is_python_build` *check_home* parameter is deprecated and
104+
ignored.
105+
106+
* :mod:`threading` methods:
107+
108+
* :meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition.notify_all`.
109+
* :meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`.
110+
* :meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`:
111+
use :attr:`threading.Thread.daemon` attribute.
112+
* :meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`:
113+
use :attr:`threading.Thread.name` attribute.
114+
* :meth:`!threading.currentThread`: use :meth:`threading.current_thread`.
115+
* :meth:`!threading.activeCount`: use :meth:`threading.active_count`.
116+
117+
* :class:`typing.Text` (:gh:`92332`).
118+
119+
* :class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a value
120+
that is not ``None`` from a test case.
121+
122+
* :mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` instead
123+
124+
* ``splitattr()``
125+
* ``splithost()``
126+
* ``splitnport()``
127+
* ``splitpasswd()``
128+
* ``splitport()``
129+
* ``splitquery()``
130+
* ``splittag()``
131+
* ``splittype()``
132+
* ``splituser()``
133+
* ``splitvalue()``
134+
* ``to_bytes()``
135+
136+
* :mod:`urllib.request`: :class:`~urllib.request.URLopener` and
137+
:class:`~urllib.request.FancyURLopener` style of invoking requests is
138+
deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods.
139+
140+
* :mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial
141+
writes.
142+
143+
* :mod:`xml.etree.ElementTree`: Testing the truth value of an
144+
:class:`~xml.etree.ElementTree.Element` is deprecated. In a future release it
145+
will always return ``True``. Prefer explicit ``len(elem)`` or
146+
``elem is not None`` tests instead.
147+
148+
* :meth:`zipimport.zipimporter.load_module` is deprecated:
149+
use :meth:`~zipimport.zipimporter.exec_module` instead.

0 commit comments

Comments
 (0)