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