• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Pending Removal in Future Versions
2----------------------------------
3
4The following APIs will be removed in the future,
5although 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(NotImplemented)``.
15  * Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)``
16    signature is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead,
17    the single argument signature.
18  * Currently Python accepts numeric literals immediately followed by keywords,
19    for example ``0in x``, ``1or x``, ``0if 1else 2``.  It allows confusing and
20    ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as
21    ``[0x1 for x in y]`` or ``[0x1f or x in y]``).  A syntax warning is raised
22    if the numeric literal is immediately followed by one of keywords
23    :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`,
24    :keyword:`in`, :keyword:`is` and :keyword:`or`.  In a future release it
25    will be changed to a syntax error. (:gh:`87999`)
26  * Support for ``__index__()`` and ``__int__()`` method returning non-int type:
27    these methods will be required to return an instance of a strict subclass of
28    :class:`int`.
29  * Support for ``__float__()`` method returning a strict subclass of
30    :class:`float`: these methods will be required to return an instance of
31    :class:`float`.
32  * Support for ``__complex__()`` method returning a strict subclass of
33    :class:`complex`: these methods will be required to return an instance of
34    :class:`complex`.
35  * Delegation of ``int()`` to ``__trunc__()`` method.
36  * Passing a complex number as the *real* or *imag* argument in the
37    :func:`complex` constructor is now deprecated; it should only be passed
38    as a single positional argument.
39    (Contributed by Serhiy Storchaka in :gh:`109218`.)
40
41* :mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants are
42  deprecated and replaced by :data:`calendar.JANUARY` and
43  :data:`calendar.FEBRUARY`.
44  (Contributed by Prince Roshan in :gh:`103636`.)
45
46* :attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method
47  instead.
48
49* :mod:`datetime`:
50
51  * :meth:`~datetime.datetime.utcnow`:
52    use ``datetime.datetime.now(tz=datetime.UTC)``.
53  * :meth:`~datetime.datetime.utcfromtimestamp`:
54    use ``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``.
55
56* :mod:`gettext`: Plural value must be an integer.
57
58* :mod:`importlib`:
59
60  * ``load_module()`` method: use ``exec_module()`` instead.
61  * :func:`~importlib.util.cache_from_source` *debug_override* parameter is
62    deprecated: use the *optimization* parameter instead.
63
64* :mod:`importlib.metadata`:
65
66  * ``EntryPoints`` tuple interface.
67  * Implicit ``None`` on return values.
68
69* :mod:`logging`: the ``warn()`` method has been deprecated
70  since Python 3.3, use :meth:`~logging.warning` instead.
71
72* :mod:`mailbox`: Use of StringIO input and text mode is deprecated, use
73  BytesIO and binary mode instead.
74
75* :mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process.
76
77* :class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is
78  deprecated, use an exception instance.
79
80* :mod:`re`: More strict rules are now applied for numerical group references
81  and group names in regular expressions.  Only sequence of ASCII digits is now
82  accepted as a numerical reference.  The group name in bytes patterns and
83  replacement strings can now only contain ASCII letters and digits and
84  underscore.
85  (Contributed by Serhiy Storchaka in :gh:`91760`.)
86
87* :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules.
88
89* :mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in
90  Python 3.12; use the *onexc* parameter instead.
91
92* :mod:`ssl` options and protocols:
93
94  * :class:`ssl.SSLContext` without protocol argument is deprecated.
95  * :class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and
96    :meth:`!selected_npn_protocol` are deprecated: use ALPN
97    instead.
98  * ``ssl.OP_NO_SSL*`` options
99  * ``ssl.OP_NO_TLS*`` options
100  * ``ssl.PROTOCOL_SSLv3``
101  * ``ssl.PROTOCOL_TLS``
102  * ``ssl.PROTOCOL_TLSv1``
103  * ``ssl.PROTOCOL_TLSv1_1``
104  * ``ssl.PROTOCOL_TLSv1_2``
105  * ``ssl.TLSVersion.SSLv3``
106  * ``ssl.TLSVersion.TLSv1``
107  * ``ssl.TLSVersion.TLSv1_1``
108
109* :func:`sysconfig.is_python_build` *check_home* parameter is deprecated and
110  ignored.
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* :class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a value
126  that is not ``None`` from a test case.
127
128* :mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` instead
129
130  * ``splitattr()``
131  * ``splithost()``
132  * ``splitnport()``
133  * ``splitpasswd()``
134  * ``splitport()``
135  * ``splitquery()``
136  * ``splittag()``
137  * ``splittype()``
138  * ``splituser()``
139  * ``splitvalue()``
140  * ``to_bytes()``
141
142* :mod:`urllib.request`: :class:`~urllib.request.URLopener` and
143  :class:`~urllib.request.FancyURLopener` style of invoking requests is
144  deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods.
145
146* :mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial
147  writes.
148
149* :mod:`xml.etree.ElementTree`: Testing the truth value of an
150  :class:`~xml.etree.ElementTree.Element` is deprecated. In a future release it
151  will always return ``True``. Prefer explicit ``len(elem)`` or
152  ``elem is not None`` tests instead.
153
154* :meth:`zipimport.zipimporter.load_module` is deprecated:
155  use :meth:`~zipimport.zipimporter.exec_module` instead.
156