Doc/deprecations/pending-removal-in-future.rst
The following APIs will be removed in the future, although there is currently no date scheduled for their removal.
:mod:argparse:
~argparse.ArgumentParser.add_argument_group is now
deprecated.argparse.FileType type converter is deprecated.:mod:builtins:
throw(type, exc, tb) and athrow(type, exc, tb)
signature is deprecated: use throw(exc) and athrow(exc) instead,
the single argument signature.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)__index__() and __int__() method returning non-int type:
these methods will be required to return an instance of a strict subclass of
:class:int.__float__() method returning a strict subclass of
:class:float: these methods will be required to return an instance of
:class:float.__complex__() method returning a strict subclass of
:class:complex: these methods will be required to return an instance of
:class:complex.complex constructor is now deprecated; it should only be passed
as a single positional argument.
(Contributed by Serhiy Storchaka in :gh:109218.):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.)
:mod:codecs: use :func:open instead of :func:codecs.open. (:gh:133038)
:attr:codeobject.co_lnotab: use the :meth:codeobject.co_lines method
instead.
:mod:datetime:
~datetime.datetime.utcnow:
use datetime.datetime.now(tz=datetime.UTC).~datetime.datetime.utcfromtimestamp:
use datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC).:mod:gettext: Plural value must be an integer.
:mod:importlib:
~importlib.util.cache_from_source debug_override parameter is
deprecated: use the optimization parameter instead.:mod:importlib.metadata:
EntryPoints tuple interface.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 a multi-threaded process.
:mod:os.path: :func:os.path.commonprefix is deprecated, use
:func:os.path.commonpath for path prefixes. The :func:os.path.commonprefix
function is being deprecated due to having a misleading name and module.
The function is not safe to use for path prefixes despite being included in a
module about path manipulation, meaning it is easy to accidentally
introduce path traversal vulnerabilities into Python programs by using this
function.
: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:shutil: :func:~shutil.rmtree's onerror parameter is deprecated in
Python 3.12; use the onexc parameter instead.
:mod:ssl options and protocols:
ssl.SSLContext without protocol argument is deprecated.ssl.SSLContext: :meth:~ssl.SSLContext.set_npn_protocols and
:meth:!selected_npn_protocol are deprecated: use ALPN
instead.ssl.OP_NO_SSL* optionsssl.OP_NO_TLS* optionsssl.PROTOCOL_SSLv3ssl.PROTOCOL_TLSssl.PROTOCOL_TLSv1ssl.PROTOCOL_TLSv1_1ssl.PROTOCOL_TLSv1_2ssl.TLSVersion.SSLv3ssl.TLSVersion.TLSv1ssl.TLSVersion.TLSv1_1:mod:threading methods:
!threading.Condition.notifyAll: use :meth:~threading.Condition.notify_all.!threading.Event.isSet: use :meth:~threading.Event.is_set.!threading.Thread.isDaemon, :meth:threading.Thread.setDaemon:
use :attr:threading.Thread.daemon attribute.!threading.Thread.getName, :meth:threading.Thread.setName:
use :attr:threading.Thread.name attribute.!threading.currentThread: use :meth:threading.current_thread.!threading.activeCount: use :meth:threading.active_count.:class:typing.Text (:gh:92332).
The internal class typing._UnionGenericAlias is no longer used to implement
:class:typing.Union. To preserve compatibility with users using this private
class, a compatibility shim will be provided until at least Python 3.17. (Contributed by
Jelle Zijlstra in :gh:105499.)
: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: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.
:func:sys._clear_type_cache is deprecated:
use :func:sys._clear_internal_caches instead.