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`:
8
9 * Nesting argument groups and nesting mutually exclusive
10 groups are deprecated.
11 * Passing the undocumented keyword argument *prefix_chars* to
12 :meth:`~argparse.ArgumentParser.add_argument_group` is now
13 deprecated.
14 * The :class:`argparse.FileType` type converter is deprecated.
15
16 * :mod:`builtins`:
17
18 * Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)``
19 signature is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead,
20 the single argument signature.
21 * Currently Python accepts numeric literals immediately followed by keywords,
22 for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and
23 ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as
24 ``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised
25 if the numeric literal is immediately followed by one of keywords
26 :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`,
27 :keyword:`in`, :keyword:`is` and :keyword:`or`. In a future release it
28 will be changed to a syntax error. (:gh:`87999`)
29 * Support for ``__index__()`` and ``__int__()`` method returning non-int type:
30 these methods will be required to return an instance of a strict subclass of
31 :class:`int`.
32 * Support for ``__float__()`` method returning a strict subclass of
33 :class:`float`: these methods will be required to return an instance of
34 :class:`float`.
35 * Support for ``__complex__()`` method returning a strict subclass of
36 :class:`complex`: these methods will be required to return an instance of
37 :class:`complex`.
38 * Passing a complex number as the *real* or *imag* argument in the
39 :func:`complex` constructor is now deprecated; it should only be passed
40 as a single positional argument.
41 (Contributed by Serhiy Storchaka in :gh:`109218`.)
42
43 * :mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants are
44 deprecated and replaced by :data:`calendar.JANUARY` and
45 :data:`calendar.FEBRUARY`.
46 (Contributed by Prince Roshan in :gh:`103636`.)
47
48 * :mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:`133038`)
49
50 * :attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method
51 instead.
52
53 * :mod:`datetime`:
54
55 * :meth:`~datetime.datetime.utcnow`:
56 use ``datetime.datetime.now(tz=datetime.UTC)``.
57 * :meth:`~datetime.datetime.utcfromtimestamp`:
58 use ``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``.
59
60 * :mod:`gettext`: Plural value must be an integer.
61
62 * :mod:`importlib`:
63
64 * :func:`~importlib.util.cache_from_source` *debug_override* parameter is
65 deprecated: use the *optimization* parameter instead.
66
67 * :mod:`importlib.metadata`:
68
69 * ``EntryPoints`` tuple interface.
70 * Implicit ``None`` on return values.
71
72 * :mod:`logging`: the ``warn()`` method has been deprecated
73 since Python 3.3, use :meth:`~logging.warning` instead.
74
75 * :mod:`mailbox`: Use of StringIO input and text mode is deprecated, use
76 BytesIO and binary mode instead.
77
78 * :mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process.
79
80 * :class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is
81 deprecated, use an exception instance.
82
83 * :mod:`re`: More strict rules are now applied for numerical group references
84 and group names in regular expressions. Only sequence of ASCII digits is now
85 accepted as a numerical reference. The group name in bytes patterns and
86 replacement strings can now only contain ASCII letters and digits and
87 underscore.
88 (Contributed by Serhiy Storchaka in :gh:`91760`.)
89
90 * :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
91
92 * :mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in
93 Python 3.12; use the *onexc* parameter instead.
94
95 * :mod:`ssl` options and protocols:
96
97 * :class:`ssl.SSLContext` without protocol argument is deprecated.
98 * :class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and
99 :meth:`!selected_npn_protocol` are deprecated: use ALPN
100 instead.
101 * ``ssl.OP_NO_SSL*`` options
102 * ``ssl.OP_NO_TLS*`` options
103 * ``ssl.PROTOCOL_SSLv3``
104 * ``ssl.PROTOCOL_TLS``
105 * ``ssl.PROTOCOL_TLSv1``
106 * ``ssl.PROTOCOL_TLSv1_1``
107 * ``ssl.PROTOCOL_TLSv1_2``
108 * ``ssl.TLSVersion.SSLv3``
109 * ``ssl.TLSVersion.TLSv1``
110 * ``ssl.TLSVersion.TLSv1_1``
111
112 * :mod:`threading` methods:
113
114 * :meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition.notify_all`.
115 * :meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`.
116 * :meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`:
117 use :attr:`threading.Thread.daemon` attribute.
118 * :meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`:
119 use :attr:`threading.Thread.name` attribute.
120 * :meth:`!threading.currentThread`: use :meth:`threading.current_thread`.
121 * :meth:`!threading.activeCount`: use :meth:`threading.active_count`.
122
123 * :class:`typing.Text` (:gh:`92332`).
124
125 * The internal class ``typing._UnionGenericAlias`` is no longer used to implement
126 :class:`typing.Union`. To preserve compatibility with users using this private
127 class, a compatibility shim will be provided until at least Python 3.17. (Contributed by
128 Jelle Zijlstra in :gh:`105499`.)
129
130 * :class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a value
131 that is not ``None`` from a test case.
132
133 * :mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` instead
134
135 * ``splitattr()``
136 * ``splithost()``
137 * ``splitnport()``
138 * ``splitpasswd()``
139 * ``splitport()``
140 * ``splitquery()``
141 * ``splittag()``
142 * ``splittype()``
143 * ``splituser()``
144 * ``splitvalue()``
145 * ``to_bytes()``
146
147 * :mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial
148 writes.
149
150 * :mod:`xml.etree.ElementTree`: Testing the truth value of an
151 :class:`~xml.etree.ElementTree.Element` is deprecated. In a future release it
152 will always return ``True``. Prefer explicit ``len(elem)`` or
153 ``elem is not None`` tests instead.
154
155 * :func:`sys._clear_type_cache` is deprecated:
156 use :func:`sys._clear_internal_caches` instead.