Debian Codegraph @

Doc/deprecations/pending-removal-in-future.rst

raw
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 * Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)``
13 signature is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead,
14 the single argument signature.
15 * Currently Python accepts numeric literals immediately followed by keywords,
16 for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and
17 ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as
18 ``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised
19 if the numeric literal is immediately followed by one of keywords
20 :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`,
21 :keyword:`in`, :keyword:`is` and :keyword:`or`. In a future release it
22 will be changed to a syntax error. (:gh:`87999`)
23 * Support for ``__index__()`` and ``__int__()`` method returning non-int type:
24 these methods will be required to return an instance of a strict subclass of
25 :class:`int`.
26 * Support for ``__float__()`` method returning a strict subclass of
27 :class:`float`: these methods will be required to return an instance of
28 :class:`float`.
29 * Support for ``__complex__()`` method returning a strict subclass of
30 :class:`complex`: these methods will be required to return an instance of
31 :class:`complex`.
32 * Delegation of ``int()`` to ``__trunc__()`` method.
33 * Passing a complex number as the *real* or *imag* argument in the
34 :func:`complex` constructor is now deprecated; it should only be passed
35 as a single positional argument.
36 (Contributed by Serhiy Storchaka in :gh:`109218`.)
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 * :func:`~importlib.util.cache_from_source` *debug_override* parameter is
58 deprecated: use the *optimization* parameter instead.
59
60 * :mod:`importlib.metadata`:
61
62 * ``EntryPoints`` tuple interface.
63 * Implicit ``None`` on return values.
64
65 * :mod:`logging`: the ``warn()`` method has been deprecated
66 since Python 3.3, use :meth:`~logging.warning` instead.
67
68 * :mod:`mailbox`: Use of StringIO input and text mode is deprecated, use
69 BytesIO and binary mode instead.
70
71 * :mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process.
72
73 * :class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is
74 deprecated, use an exception instance.
75
76 * :mod:`re`: More strict rules are now applied for numerical group references
77 and group names in regular expressions. Only sequence of ASCII digits is now
78 accepted as a numerical reference. The group name in bytes patterns and
79 replacement strings can now only contain ASCII letters and digits and
80 underscore.
81 (Contributed by Serhiy Storchaka in :gh:`91760`.)
82
83 * :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
84
85 * :mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in
86 Python 3.12; use the *onexc* parameter instead.
87
88 * :mod:`ssl` options and protocols:
89
90 * :class:`ssl.SSLContext` without protocol argument is deprecated.
91 * :class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and
92 :meth:`!selected_npn_protocol` are deprecated: use ALPN
93 instead.
94 * ``ssl.OP_NO_SSL*`` options
95 * ``ssl.OP_NO_TLS*`` options
96 * ``ssl.PROTOCOL_SSLv3``
97 * ``ssl.PROTOCOL_TLS``
98 * ``ssl.PROTOCOL_TLSv1``
99 * ``ssl.PROTOCOL_TLSv1_1``
100 * ``ssl.PROTOCOL_TLSv1_2``
101 * ``ssl.TLSVersion.SSLv3``
102 * ``ssl.TLSVersion.TLSv1``
103 * ``ssl.TLSVersion.TLSv1_1``
104
105 * :mod:`threading` methods:
106
107 * :meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition.notify_all`.
108 * :meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`.
109 * :meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`:
110 use :attr:`threading.Thread.daemon` attribute.
111 * :meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`:
112 use :attr:`threading.Thread.name` attribute.
113 * :meth:`!threading.currentThread`: use :meth:`threading.current_thread`.
114 * :meth:`!threading.activeCount`: use :meth:`threading.active_count`.
115
116 * :class:`typing.Text` (:gh:`92332`).
117
118 * :class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a value
119 that is not ``None`` from a test case.
120
121 * :mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` instead
122
123 * ``splitattr()``
124 * ``splithost()``
125 * ``splitnport()``
126 * ``splitpasswd()``
127 * ``splitport()``
128 * ``splitquery()``
129 * ``splittag()``
130 * ``splittype()``
131 * ``splituser()``
132 * ``splitvalue()``
133 * ``to_bytes()``
134
135 * :mod:`urllib.request`: :class:`~urllib.request.URLopener` and
136 :class:`~urllib.request.FancyURLopener` style of invoking requests is
137 deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods.
138
139 * :mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial
140 writes.
141
142 * :mod:`xml.etree.ElementTree`: Testing the truth value of an
143 :class:`~xml.etree.ElementTree.Element` is deprecated. In a future release it
144 will always return ``True``. Prefer explicit ``len(elem)`` or
145 ``elem is not None`` tests instead.
146
147 * :meth:`zipimport.zipimporter.load_module` is deprecated:
148 use :meth:`~zipimport.zipimporter.exec_module` instead.