CINXE.COM
Deprecations — Python 3.13.0 documentation
<!DOCTYPE html> <html lang="en" data-content_root="../"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" /> <meta property="og:title" content="Deprecations" /> <meta property="og:type" content="website" /> <meta property="og:url" content="https://docs.python.org/3/deprecations/index.html" /> <meta property="og:site_name" content="Python documentation" /> <meta property="og:description" content="Pending Removal in Python 3.14: argparse: The type, choices, and metavar parameters of argparse.BooleanOptionalAction are deprecated and will be removed in 3.14. (Contributed by Nikita Sobolev in g..." /> <meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" /> <meta property="og:image:alt" content="Python documentation" /> <meta name="description" content="Pending Removal in Python 3.14: argparse: The type, choices, and metavar parameters of argparse.BooleanOptionalAction are deprecated and will be removed in 3.14. (Contributed by Nikita Sobolev in g..." /> <meta property="og:image:width" content="200" /> <meta property="og:image:height" content="200" /> <meta name="theme-color" content="#3776ab" /> <title>Deprecations — Python 3.13.0 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=80d5e7a1" /> <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=41b4f12d" /> <link rel="stylesheet" type="text/css" href="../_static/sidebar-wrap.css?v=65806c5a" /> <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=b20cc3f5" /> <script src="../_static/documentation_options.js?v=6aaf4047"></script> <script src="../_static/doctools.js?v=9bcbadda"></script> <script src="../_static/sphinx_highlight.js?v=dc90522c"></script> <script src="../_static/sidebar.js"></script> <link rel="search" type="application/opensearchdescription+xml" title="Search within Python 3.13.0 documentation" href="../_static/opensearch.xml"/> <link rel="author" title="About these documents" href="../about.html" /> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="copyright" title="Copyright" href="../copyright.html" /> <link rel="next" title="Glossary" href="../glossary.html" /> <link rel="prev" title="“Why is Python Installed on my Computer?” FAQ" href="../faq/installed.html" /> <script defer data-domain="docs.python.org" src="https://plausible.io/js/script.js"></script> <link rel="canonical" href="https://docs.python.org/3/deprecations/index.html" /> <style> @media only screen { table.full-width-table { width: 100%; } } </style> <link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css"> <link rel="shortcut icon" type="image/png" href="../_static/py.svg" /> <script type="text/javascript" src="../_static/copybutton.js"></script> <script type="text/javascript" src="../_static/menu.js"></script> <script type="text/javascript" src="../_static/search-focus.js"></script> <script type="text/javascript" src="../_static/themetoggle.js"></script> <script type="text/javascript" src="../_static/rtd_switcher.js"></script> <meta name="readthedocs-addons-api-version" content="1"> </head> <body> <div class="mobile-nav"> <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation" aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" /> <nav class="nav-content" role="navigation"> <label for="menuToggler" class="toggler__label"> <span></span> </label> <span class="nav-items-wrapper"> <a href="https://www.python.org/" class="nav-logo"> <img src="../_static/py.svg" alt="Python logo"/> </a> <span class="version_switcher_placeholder"></span> <form role="search" class="search" action="../search.html" method="get"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon"> <path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> </svg> <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" /> <input type="submit" value="Go"/> </form> </span> </nav> <div class="menu-wrapper"> <nav class="menu" role="navigation" aria-label="main navigation"> <div class="language_switcher_placeholder"></div> <label class="theme-selector-label"> Theme <select class="theme-selector" oninput="activateTheme(this.value)"> <option value="auto" selected>Auto</option> <option value="light">Light</option> <option value="dark">Dark</option> </select> </label> <div> <h3><a href="../contents.html">Table of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Deprecations</a><ul> <li><a class="reference internal" href="#pending-removal-in-python-3-14">Pending Removal in Python 3.14</a></li> <li><a class="reference internal" href="#pending-removal-in-python-3-15">Pending Removal in Python 3.15</a></li> <li><a class="reference internal" href="#pending-removal-in-python-3-16">Pending removal in Python 3.16</a></li> <li><a class="reference internal" href="#pending-removal-in-future-versions">Pending Removal in Future Versions</a></li> <li><a class="reference internal" href="#c-api-deprecations">C API Deprecations</a><ul> <li><a class="reference internal" href="#id1">Pending Removal in Python 3.14</a></li> <li><a class="reference internal" href="#id2">Pending Removal in Python 3.15</a></li> <li><a class="reference internal" href="#id3">Pending Removal in Future Versions</a></li> </ul> </li> </ul> </li> </ul> </div> <div> <h4>Previous topic</h4> <p class="topless"><a href="../faq/installed.html" title="previous chapter">“Why is Python Installed on my Computer?” FAQ</a></p> </div> <div> <h4>Next topic</h4> <p class="topless"><a href="../glossary.html" title="next chapter">Glossary</a></p> </div> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../bugs.html">Report a Bug</a></li> <li> <a href="https://github.com/python/cpython/blob/main/Doc/deprecations/index.rst" rel="nofollow">Show Source </a> </li> </ul> </div> </nav> </div> </div> <div class="related" role="navigation" aria-label="Related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="../glossary.html" title="Glossary" accesskey="N">next</a> |</li> <li class="right" > <a href="../faq/installed.html" title="“Why is Python Installed on my Computer?” FAQ" accesskey="P">previous</a> |</li> <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="https://www.python.org/">Python</a> »</li> <li class="switchers"> <div class="language_switcher_placeholder"></div> <div class="version_switcher_placeholder"></div> </li> <li> </li> <li id="cpython-language-and-version"> <a href="../index.html">3.13.0 Documentation</a> » </li> <li class="nav-item nav-item-this"><a href="">Deprecations</a></li> <li class="right"> <div class="inline-search" role="search"> <form class="inline-search" action="../search.html" method="get"> <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" /> <input type="submit" value="Go" /> </form> </div> | </li> <li class="right"> <label class="theme-selector-label"> Theme <select class="theme-selector" oninput="activateTheme(this.value)"> <option value="auto" selected>Auto</option> <option value="light">Light</option> <option value="dark">Dark</option> </select> </label> |</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <section id="deprecations"> <h1>Deprecations<a class="headerlink" href="#deprecations" title="Link to this heading">¶</a></h1> <section id="pending-removal-in-python-3-14"> <h2>Pending Removal in Python 3.14<a class="headerlink" href="#pending-removal-in-python-3-14" title="Link to this heading">¶</a></h2> <ul> <li><p><a class="reference internal" href="../library/argparse.html#module-argparse" title="argparse: Command-line option and argument parsing library."><code class="xref py py-mod docutils literal notranslate"><span class="pre">argparse</span></code></a>: The <em>type</em>, <em>choices</em>, and <em>metavar</em> parameters of <code class="xref py py-class docutils literal notranslate"><span class="pre">argparse.BooleanOptionalAction</span></code> are deprecated and will be removed in 3.14. (Contributed by Nikita Sobolev in <a class="reference external" href="https://github.com/python/cpython/issues/92248">gh-92248</a>.)</p></li> <li><p><a class="reference internal" href="../library/ast.html#module-ast" title="ast: Abstract Syntax Tree classes and manipulation."><code class="xref py py-mod docutils literal notranslate"><span class="pre">ast</span></code></a>: The following features have been deprecated in documentation since Python 3.8, now cause a <a class="reference internal" href="../library/exceptions.html#DeprecationWarning" title="DeprecationWarning"><code class="xref py py-exc docutils literal notranslate"><span class="pre">DeprecationWarning</span></code></a> to be emitted at runtime when they are accessed or used, and will be removed in Python 3.14:</p> <ul class="simple"> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ast.Num</span></code></p></li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ast.Str</span></code></p></li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ast.Bytes</span></code></p></li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ast.NameConstant</span></code></p></li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ast.Ellipsis</span></code></p></li> </ul> <p>Use <a class="reference internal" href="../library/ast.html#ast.Constant" title="ast.Constant"><code class="xref py py-class docutils literal notranslate"><span class="pre">ast.Constant</span></code></a> instead. (Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/90953">gh-90953</a>.)</p> </li> <li><p><a class="reference internal" href="../library/asyncio.html#module-asyncio" title="asyncio: Asynchronous I/O."><code class="xref py py-mod docutils literal notranslate"><span class="pre">asyncio</span></code></a>:</p> <ul class="simple"> <li><p>The child watcher classes <a class="reference internal" href="../library/asyncio-policy.html#asyncio.MultiLoopChildWatcher" title="asyncio.MultiLoopChildWatcher"><code class="xref py py-class docutils literal notranslate"><span class="pre">MultiLoopChildWatcher</span></code></a>, <a class="reference internal" href="../library/asyncio-policy.html#asyncio.FastChildWatcher" title="asyncio.FastChildWatcher"><code class="xref py py-class docutils literal notranslate"><span class="pre">FastChildWatcher</span></code></a>, <a class="reference internal" href="../library/asyncio-policy.html#asyncio.AbstractChildWatcher" title="asyncio.AbstractChildWatcher"><code class="xref py py-class docutils literal notranslate"><span class="pre">AbstractChildWatcher</span></code></a> and <a class="reference internal" href="../library/asyncio-policy.html#asyncio.SafeChildWatcher" title="asyncio.SafeChildWatcher"><code class="xref py py-class docutils literal notranslate"><span class="pre">SafeChildWatcher</span></code></a> are deprecated and will be removed in Python 3.14. (Contributed by Kumar Aditya in <a class="reference external" href="https://github.com/python/cpython/issues/94597">gh-94597</a>.)</p></li> <li><p><a class="reference internal" href="../library/asyncio-policy.html#asyncio.set_child_watcher" title="asyncio.set_child_watcher"><code class="xref py py-func docutils literal notranslate"><span class="pre">asyncio.set_child_watcher()</span></code></a>, <a class="reference internal" href="../library/asyncio-policy.html#asyncio.get_child_watcher" title="asyncio.get_child_watcher"><code class="xref py py-func docutils literal notranslate"><span class="pre">asyncio.get_child_watcher()</span></code></a>, <a class="reference internal" href="../library/asyncio-policy.html#asyncio.AbstractEventLoopPolicy.set_child_watcher" title="asyncio.AbstractEventLoopPolicy.set_child_watcher"><code class="xref py py-meth docutils literal notranslate"><span class="pre">asyncio.AbstractEventLoopPolicy.set_child_watcher()</span></code></a> and <a class="reference internal" href="../library/asyncio-policy.html#asyncio.AbstractEventLoopPolicy.get_child_watcher" title="asyncio.AbstractEventLoopPolicy.get_child_watcher"><code class="xref py py-meth docutils literal notranslate"><span class="pre">asyncio.AbstractEventLoopPolicy.get_child_watcher()</span></code></a> are deprecated and will be removed in Python 3.14. (Contributed by Kumar Aditya in <a class="reference external" href="https://github.com/python/cpython/issues/94597">gh-94597</a>.)</p></li> <li><p>The <a class="reference internal" href="../library/asyncio-eventloop.html#asyncio.get_event_loop" title="asyncio.get_event_loop"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_event_loop()</span></code></a> method of the default event loop policy now emits a <a class="reference internal" href="../library/exceptions.html#DeprecationWarning" title="DeprecationWarning"><code class="xref py py-exc docutils literal notranslate"><span class="pre">DeprecationWarning</span></code></a> if there is no current event loop set and it decides to create one. (Contributed by Serhiy Storchaka and Guido van Rossum in <a class="reference external" href="https://github.com/python/cpython/issues/100160">gh-100160</a>.)</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/collections.abc.html#module-collections.abc" title="collections.abc: Abstract base classes for containers"><code class="xref py py-mod docutils literal notranslate"><span class="pre">collections.abc</span></code></a>: Deprecated <a class="reference internal" href="../library/collections.abc.html#collections.abc.ByteString" title="collections.abc.ByteString"><code class="xref py py-class docutils literal notranslate"><span class="pre">ByteString</span></code></a>. Prefer <code class="xref py py-class docutils literal notranslate"><span class="pre">Sequence</span></code> or <a class="reference internal" href="../library/collections.abc.html#collections.abc.Buffer" title="collections.abc.Buffer"><code class="xref py py-class docutils literal notranslate"><span class="pre">Buffer</span></code></a>. For use in typing, prefer a union, like <code class="docutils literal notranslate"><span class="pre">bytes</span> <span class="pre">|</span> <span class="pre">bytearray</span></code>, or <a class="reference internal" href="../library/collections.abc.html#collections.abc.Buffer" title="collections.abc.Buffer"><code class="xref py py-class docutils literal notranslate"><span class="pre">collections.abc.Buffer</span></code></a>. (Contributed by Shantanu Jain in <a class="reference external" href="https://github.com/python/cpython/issues/91896">gh-91896</a>.)</p></li> <li><p><a class="reference internal" href="../library/email.html#module-email" title="email: Package supporting the parsing, manipulating, and generating email messages."><code class="xref py py-mod docutils literal notranslate"><span class="pre">email</span></code></a>: Deprecated the <em>isdst</em> parameter in <a class="reference internal" href="../library/email.utils.html#email.utils.localtime" title="email.utils.localtime"><code class="xref py py-func docutils literal notranslate"><span class="pre">email.utils.localtime()</span></code></a>. (Contributed by Alan Williams in <a class="reference external" href="https://github.com/python/cpython/issues/72346">gh-72346</a>.)</p></li> <li><p><a class="reference internal" href="../library/importlib.html#module-importlib.abc" title="importlib.abc: Abstract base classes related to import"><code class="xref py py-mod docutils literal notranslate"><span class="pre">importlib.abc</span></code></a> deprecated classes:</p> <ul class="simple"> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">importlib.abc.ResourceReader</span></code></p></li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">importlib.abc.Traversable</span></code></p></li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">importlib.abc.TraversableResources</span></code></p></li> </ul> <p>Use <a class="reference internal" href="../library/importlib.resources.abc.html#module-importlib.resources.abc" title="importlib.resources.abc: Abstract base classes for resources"><code class="xref py py-mod docutils literal notranslate"><span class="pre">importlib.resources.abc</span></code></a> classes instead:</p> <ul class="simple"> <li><p><a class="reference internal" href="../library/importlib.resources.abc.html#importlib.resources.abc.Traversable" title="importlib.resources.abc.Traversable"><code class="xref py py-class docutils literal notranslate"><span class="pre">importlib.resources.abc.Traversable</span></code></a></p></li> <li><p><a class="reference internal" href="../library/importlib.resources.abc.html#importlib.resources.abc.TraversableResources" title="importlib.resources.abc.TraversableResources"><code class="xref py py-class docutils literal notranslate"><span class="pre">importlib.resources.abc.TraversableResources</span></code></a></p></li> </ul> <p>(Contributed by Jason R. Coombs and Hugo van Kemenade in <a class="reference external" href="https://github.com/python/cpython/issues/93963">gh-93963</a>.)</p> </li> <li><p><a class="reference internal" href="../library/itertools.html#module-itertools" title="itertools: Functions creating iterators for efficient looping."><code class="xref py py-mod docutils literal notranslate"><span class="pre">itertools</span></code></a> had undocumented, inefficient, historically buggy, and inconsistent support for copy, deepcopy, and pickle operations. This will be removed in 3.14 for a significant reduction in code volume and maintenance burden. (Contributed by Raymond Hettinger in <a class="reference external" href="https://github.com/python/cpython/issues/101588">gh-101588</a>.)</p></li> <li><p><a class="reference internal" href="../library/multiprocessing.html#module-multiprocessing" title="multiprocessing: Process-based parallelism."><code class="xref py py-mod docutils literal notranslate"><span class="pre">multiprocessing</span></code></a>: The default start method will change to a safer one on Linux, BSDs, and other non-macOS POSIX platforms where <code class="docutils literal notranslate"><span class="pre">'fork'</span></code> is currently the default (<a class="reference external" href="https://github.com/python/cpython/issues/84559">gh-84559</a>). Adding a runtime warning about this was deemed too disruptive as the majority of code is not expected to care. Use the <a class="reference internal" href="../library/multiprocessing.html#multiprocessing.get_context" title="multiprocessing.get_context"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_context()</span></code></a> or <a class="reference internal" href="../library/multiprocessing.html#multiprocessing.set_start_method" title="multiprocessing.set_start_method"><code class="xref py py-func docutils literal notranslate"><span class="pre">set_start_method()</span></code></a> APIs to explicitly specify when your code <em>requires</em> <code class="docutils literal notranslate"><span class="pre">'fork'</span></code>. See <a class="reference internal" href="../library/multiprocessing.html#multiprocessing-start-methods"><span class="std std-ref">Contexts and start methods</span></a>.</p></li> <li><p><a class="reference internal" href="../library/pathlib.html#module-pathlib" title="pathlib: Object-oriented filesystem paths"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pathlib</span></code></a>: <a class="reference internal" href="../library/pathlib.html#pathlib.PurePath.is_relative_to" title="pathlib.PurePath.is_relative_to"><code class="xref py py-meth docutils literal notranslate"><span class="pre">is_relative_to()</span></code></a> and <a class="reference internal" href="../library/pathlib.html#pathlib.PurePath.relative_to" title="pathlib.PurePath.relative_to"><code class="xref py py-meth docutils literal notranslate"><span class="pre">relative_to()</span></code></a>: passing additional arguments is deprecated.</p></li> <li><p><a class="reference internal" href="../library/pkgutil.html#module-pkgutil" title="pkgutil: Utilities for the import system."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pkgutil</span></code></a>: <a class="reference internal" href="../library/pkgutil.html#pkgutil.find_loader" title="pkgutil.find_loader"><code class="xref py py-func docutils literal notranslate"><span class="pre">find_loader()</span></code></a> and <a class="reference internal" href="../library/pkgutil.html#pkgutil.get_loader" title="pkgutil.get_loader"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_loader()</span></code></a> now raise <a class="reference internal" href="../library/exceptions.html#DeprecationWarning" title="DeprecationWarning"><code class="xref py py-exc docutils literal notranslate"><span class="pre">DeprecationWarning</span></code></a>; use <a class="reference internal" href="../library/importlib.html#importlib.util.find_spec" title="importlib.util.find_spec"><code class="xref py py-func docutils literal notranslate"><span class="pre">importlib.util.find_spec()</span></code></a> instead. (Contributed by Nikita Sobolev in <a class="reference external" href="https://github.com/python/cpython/issues/97850">gh-97850</a>.)</p></li> <li><p><a class="reference internal" href="../library/pty.html#module-pty" title="pty: Pseudo-Terminal Handling for Unix. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pty</span></code></a>:</p> <ul class="simple"> <li><p><code class="docutils literal notranslate"><span class="pre">master_open()</span></code>: use <a class="reference internal" href="../library/pty.html#pty.openpty" title="pty.openpty"><code class="xref py py-func docutils literal notranslate"><span class="pre">pty.openpty()</span></code></a>.</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">slave_open()</span></code>: use <a class="reference internal" href="../library/pty.html#pty.openpty" title="pty.openpty"><code class="xref py py-func docutils literal notranslate"><span class="pre">pty.openpty()</span></code></a>.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/sqlite3.html#module-sqlite3" title="sqlite3: A DB-API 2.0 implementation using SQLite 3.x."><code class="xref py py-mod docutils literal notranslate"><span class="pre">sqlite3</span></code></a>:</p> <ul class="simple"> <li><p><a class="reference internal" href="../library/sqlite3.html#sqlite3.version" title="sqlite3.version"><code class="xref py py-data docutils literal notranslate"><span class="pre">version</span></code></a> and <a class="reference internal" href="../library/sqlite3.html#sqlite3.version_info" title="sqlite3.version_info"><code class="xref py py-data docutils literal notranslate"><span class="pre">version_info</span></code></a>.</p></li> <li><p><a class="reference internal" href="../library/sqlite3.html#sqlite3.Cursor.execute" title="sqlite3.Cursor.execute"><code class="xref py py-meth docutils literal notranslate"><span class="pre">execute()</span></code></a> and <a class="reference internal" href="../library/sqlite3.html#sqlite3.Cursor.executemany" title="sqlite3.Cursor.executemany"><code class="xref py py-meth docutils literal notranslate"><span class="pre">executemany()</span></code></a> if <a class="reference internal" href="../library/sqlite3.html#sqlite3-placeholders"><span class="std std-ref">named placeholders</span></a> are used and <em>parameters</em> is a sequence instead of a <a class="reference internal" href="../library/stdtypes.html#dict" title="dict"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a>.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/typing.html#module-typing" title="typing: Support for type hints (see :pep:`484`)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">typing</span></code></a>: <a class="reference internal" href="../library/typing.html#typing.ByteString" title="typing.ByteString"><code class="xref py py-class docutils literal notranslate"><span class="pre">ByteString</span></code></a>, deprecated since Python 3.9, now causes a <a class="reference internal" href="../library/exceptions.html#DeprecationWarning" title="DeprecationWarning"><code class="xref py py-exc docutils literal notranslate"><span class="pre">DeprecationWarning</span></code></a> to be emitted when it is used.</p></li> <li><p><a class="reference internal" href="../library/urllib.html#module-urllib" title="urllib"><code class="xref py py-mod docutils literal notranslate"><span class="pre">urllib</span></code></a>: <code class="xref py py-class docutils literal notranslate"><span class="pre">urllib.parse.Quoter</span></code> is deprecated: it was not intended to be a public API. (Contributed by Gregory P. Smith in <a class="reference external" href="https://github.com/python/cpython/issues/88168">gh-88168</a>.)</p></li> </ul> </section> <section id="pending-removal-in-python-3-15"> <h2>Pending Removal in Python 3.15<a class="headerlink" href="#pending-removal-in-python-3-15" title="Link to this heading">¶</a></h2> <ul class="simple"> <li><p>The import system:</p> <ul> <li><p>Setting <a class="reference internal" href="../reference/datamodel.html#module.__cached__" title="module.__cached__"><code class="xref py py-attr docutils literal notranslate"><span class="pre">__cached__</span></code></a> on a module while failing to set <a class="reference internal" href="../library/importlib.html#importlib.machinery.ModuleSpec.cached" title="importlib.machinery.ModuleSpec.cached"><code class="xref py py-attr docutils literal notranslate"><span class="pre">__spec__.cached</span></code></a> is deprecated. In Python 3.15, <code class="xref py py-attr docutils literal notranslate"><span class="pre">__cached__</span></code> will cease to be set or take into consideration by the import system or standard library. (<a class="reference external" href="https://github.com/python/cpython/issues/97879">gh-97879</a>)</p></li> <li><p>Setting <a class="reference internal" href="../reference/datamodel.html#module.__package__" title="module.__package__"><code class="xref py py-attr docutils literal notranslate"><span class="pre">__package__</span></code></a> on a module while failing to set <a class="reference internal" href="../library/importlib.html#importlib.machinery.ModuleSpec.parent" title="importlib.machinery.ModuleSpec.parent"><code class="xref py py-attr docutils literal notranslate"><span class="pre">__spec__.parent</span></code></a> is deprecated. In Python 3.15, <code class="xref py py-attr docutils literal notranslate"><span class="pre">__package__</span></code> will cease to be set or take into consideration by the import system or standard library. (<a class="reference external" href="https://github.com/python/cpython/issues/97879">gh-97879</a>)</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/ctypes.html#module-ctypes" title="ctypes: A foreign function library for Python."><code class="xref py py-mod docutils literal notranslate"><span class="pre">ctypes</span></code></a>:</p> <ul> <li><p>The undocumented <code class="xref py py-func docutils literal notranslate"><span class="pre">ctypes.SetPointerType()</span></code> function has been deprecated since Python 3.13.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/http.server.html#module-http.server" title="http.server: HTTP server and request handlers."><code class="xref py py-mod docutils literal notranslate"><span class="pre">http.server</span></code></a>:</p> <ul> <li><p>The obsolete and rarely used <a class="reference internal" href="../library/http.server.html#http.server.CGIHTTPRequestHandler" title="http.server.CGIHTTPRequestHandler"><code class="xref py py-class docutils literal notranslate"><span class="pre">CGIHTTPRequestHandler</span></code></a> has been deprecated since Python 3.13. No direct replacement exists. <em>Anything</em> is better than CGI to interface a web server with a request handler.</p></li> <li><p>The <code class="xref std std-option docutils literal notranslate"><span class="pre">--cgi</span></code> flag to the <strong class="program">python -m http.server</strong> command-line interface has been deprecated since Python 3.13.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/locale.html#module-locale" title="locale: Internationalization services."><code class="xref py py-class docutils literal notranslate"><span class="pre">locale</span></code></a>:</p> <ul> <li><p>The <a class="reference internal" href="../library/locale.html#locale.getdefaultlocale" title="locale.getdefaultlocale"><code class="xref py py-func docutils literal notranslate"><span class="pre">getdefaultlocale()</span></code></a> function has been deprecated since Python 3.11. Its removal was originally planned for Python 3.13 (<a class="reference external" href="https://github.com/python/cpython/issues/90817">gh-90817</a>), but has been postponed to Python 3.15. Use <a class="reference internal" href="../library/locale.html#locale.getlocale" title="locale.getlocale"><code class="xref py py-func docutils literal notranslate"><span class="pre">getlocale()</span></code></a>, <a class="reference internal" href="../library/locale.html#locale.setlocale" title="locale.setlocale"><code class="xref py py-func docutils literal notranslate"><span class="pre">setlocale()</span></code></a>, and <a class="reference internal" href="../library/locale.html#locale.getencoding" title="locale.getencoding"><code class="xref py py-func docutils literal notranslate"><span class="pre">getencoding()</span></code></a> instead. (Contributed by Hugo van Kemenade in <a class="reference external" href="https://github.com/python/cpython/issues/111187">gh-111187</a>.)</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/pathlib.html#module-pathlib" title="pathlib: Object-oriented filesystem paths"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pathlib</span></code></a>:</p> <ul> <li><p><a class="reference internal" href="../library/pathlib.html#pathlib.PurePath.is_reserved" title="pathlib.PurePath.is_reserved"><code class="xref py py-meth docutils literal notranslate"><span class="pre">PurePath.is_reserved()</span></code></a> has been deprecated since Python 3.13. Use <a class="reference internal" href="../library/os.path.html#os.path.isreserved" title="os.path.isreserved"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.path.isreserved()</span></code></a> to detect reserved paths on Windows.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/platform.html#module-platform" title="platform: Retrieves as much platform identifying data as possible."><code class="xref py py-mod docutils literal notranslate"><span class="pre">platform</span></code></a>:</p> <ul> <li><p><a class="reference internal" href="../library/platform.html#platform.java_ver" title="platform.java_ver"><code class="xref py py-func docutils literal notranslate"><span class="pre">java_ver()</span></code></a> has been deprecated since Python 3.13. This function is only useful for Jython support, has a confusing API, and is largely untested.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/threading.html#module-threading" title="threading: Thread-based parallelism."><code class="xref py py-mod docutils literal notranslate"><span class="pre">threading</span></code></a>:</p> <ul> <li><p><a class="reference internal" href="../library/threading.html#threading.RLock" title="threading.RLock"><code class="xref py py-func docutils literal notranslate"><span class="pre">RLock()</span></code></a> will take no arguments in Python 3.15. Passing any arguments has been deprecated since Python 3.14, as the Python version does not permit any arguments, but the C version allows any number of positional or keyword arguments, ignoring every argument.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/types.html#module-types" title="types: Names for built-in types."><code class="xref py py-mod docutils literal notranslate"><span class="pre">types</span></code></a>:</p> <ul> <li><p><a class="reference internal" href="../library/types.html#types.CodeType" title="types.CodeType"><code class="xref py py-class docutils literal notranslate"><span class="pre">types.CodeType</span></code></a>: Accessing <a class="reference internal" href="../reference/datamodel.html#codeobject.co_lnotab" title="codeobject.co_lnotab"><code class="xref py py-attr docutils literal notranslate"><span class="pre">co_lnotab</span></code></a> was deprecated in <span class="target" id="index-0"></span><a class="pep reference external" href="https://peps.python.org/pep-0626/"><strong>PEP 626</strong></a> since 3.10 and was planned to be removed in 3.12, but it only got a proper <a class="reference internal" href="../library/exceptions.html#DeprecationWarning" title="DeprecationWarning"><code class="xref py py-exc docutils literal notranslate"><span class="pre">DeprecationWarning</span></code></a> in 3.12. May be removed in 3.15. (Contributed by Nikita Sobolev in <a class="reference external" href="https://github.com/python/cpython/issues/101866">gh-101866</a>.)</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/typing.html#module-typing" title="typing: Support for type hints (see :pep:`484`)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">typing</span></code></a>:</p> <ul> <li><p>The undocumented keyword argument syntax for creating <a class="reference internal" href="../library/typing.html#typing.NamedTuple" title="typing.NamedTuple"><code class="xref py py-class docutils literal notranslate"><span class="pre">NamedTuple</span></code></a> classes (e.g. <code class="docutils literal notranslate"><span class="pre">Point</span> <span class="pre">=</span> <span class="pre">NamedTuple("Point",</span> <span class="pre">x=int,</span> <span class="pre">y=int)</span></code>) has been deprecated since Python 3.13. Use the class-based syntax or the functional syntax instead.</p></li> <li><p>The <a class="reference internal" href="../library/typing.html#typing.no_type_check_decorator" title="typing.no_type_check_decorator"><code class="xref py py-func docutils literal notranslate"><span class="pre">typing.no_type_check_decorator()</span></code></a> decorator function has been deprecated since Python 3.13. After eight years in the <a class="reference internal" href="../library/typing.html#module-typing" title="typing: Support for type hints (see :pep:`484`)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">typing</span></code></a> module, it has yet to be supported by any major type checker.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/wave.html#module-wave" title="wave: Provide an interface to the WAV sound format."><code class="xref py py-mod docutils literal notranslate"><span class="pre">wave</span></code></a>:</p> <ul> <li><p>The <a class="reference internal" href="../library/wave.html#wave.Wave_read.getmark" title="wave.Wave_read.getmark"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getmark()</span></code></a>, <code class="xref py py-meth docutils literal notranslate"><span class="pre">setmark()</span></code>, and <a class="reference internal" href="../library/wave.html#wave.Wave_read.getmarkers" title="wave.Wave_read.getmarkers"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getmarkers()</span></code></a> methods of the <a class="reference internal" href="../library/wave.html#wave.Wave_read" title="wave.Wave_read"><code class="xref py py-class docutils literal notranslate"><span class="pre">Wave_read</span></code></a> and <a class="reference internal" href="../library/wave.html#wave.Wave_write" title="wave.Wave_write"><code class="xref py py-class docutils literal notranslate"><span class="pre">Wave_write</span></code></a> classes have been deprecated since Python 3.13.</p></li> </ul> </li> </ul> </section> <section id="pending-removal-in-python-3-16"> <h2>Pending removal in Python 3.16<a class="headerlink" href="#pending-removal-in-python-3-16" title="Link to this heading">¶</a></h2> <ul class="simple"> <li><p>The import system:</p> <ul> <li><p>Setting <a class="reference internal" href="../reference/datamodel.html#module.__loader__" title="module.__loader__"><code class="xref py py-attr docutils literal notranslate"><span class="pre">__loader__</span></code></a> on a module while failing to set <a class="reference internal" href="../library/importlib.html#importlib.machinery.ModuleSpec.loader" title="importlib.machinery.ModuleSpec.loader"><code class="xref py py-attr docutils literal notranslate"><span class="pre">__spec__.loader</span></code></a> is deprecated. In Python 3.16, <code class="xref py py-attr docutils literal notranslate"><span class="pre">__loader__</span></code> will cease to be set or taken into consideration by the import system or the standard library.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/array.html#module-array" title="array: Space efficient arrays of uniformly typed numeric values."><code class="xref py py-mod docutils literal notranslate"><span class="pre">array</span></code></a>:</p> <ul> <li><p>The <code class="docutils literal notranslate"><span class="pre">'u'</span></code> format code (<code class="xref c c-type docutils literal notranslate"><span class="pre">wchar_t</span></code>) has been deprecated in documentation since Python 3.3 and at runtime since Python 3.13. Use the <code class="docutils literal notranslate"><span class="pre">'w'</span></code> format code (<a class="reference internal" href="../c-api/unicode.html#c.Py_UCS4" title="Py_UCS4"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_UCS4</span></code></a>) for Unicode characters instead.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/asyncio.html#module-asyncio" title="asyncio: Asynchronous I/O."><code class="xref py py-mod docutils literal notranslate"><span class="pre">asyncio</span></code></a>:</p> <ul> <li><p><code class="xref py py-func docutils literal notranslate"><span class="pre">asyncio.iscoroutinefunction()</span></code> is deprecated and will be removed in Python 3.16, use <a class="reference internal" href="../library/inspect.html#inspect.iscoroutinefunction" title="inspect.iscoroutinefunction"><code class="xref py py-func docutils literal notranslate"><span class="pre">inspect.iscoroutinefunction()</span></code></a> instead. (Contributed by Jiahao Li and Kumar Aditya in <a class="reference external" href="https://github.com/python/cpython/issues/122875">gh-122875</a>.)</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/builtins.html#module-builtins" title="builtins: The module that provides the built-in namespace."><code class="xref py py-mod docutils literal notranslate"><span class="pre">builtins</span></code></a>:</p> <ul> <li><p>Bitwise inversion on boolean types, <code class="docutils literal notranslate"><span class="pre">~True</span></code> or <code class="docutils literal notranslate"><span class="pre">~False</span></code> has been deprecated since Python 3.12, as it produces surprising and unintuitive results (<code class="docutils literal notranslate"><span class="pre">-2</span></code> and <code class="docutils literal notranslate"><span class="pre">-1</span></code>). Use <code class="docutils literal notranslate"><span class="pre">not</span> <span class="pre">x</span></code> instead for the logical negation of a Boolean. In the rare case that you need the bitwise inversion of the underlying integer, convert to <code class="docutils literal notranslate"><span class="pre">int</span></code> explicitly (<code class="docutils literal notranslate"><span class="pre">~int(x)</span></code>).</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/shutil.html#module-shutil" title="shutil: High-level file operations, including copying."><code class="xref py py-mod docutils literal notranslate"><span class="pre">shutil</span></code></a>:</p> <ul> <li><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">ExecError</span></code> exception has been deprecated since Python 3.14. It has not been used by any function in <code class="xref py py-mod docutils literal notranslate"><span class="pre">shutil</span></code> since Python 3.4, and is now an alias of <a class="reference internal" href="../library/exceptions.html#RuntimeError" title="RuntimeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">RuntimeError</span></code></a>.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/symtable.html#module-symtable" title="symtable: Interface to the compiler's internal symbol tables."><code class="xref py py-mod docutils literal notranslate"><span class="pre">symtable</span></code></a>:</p> <ul> <li><p>The <a class="reference internal" href="../library/symtable.html#symtable.Class.get_methods" title="symtable.Class.get_methods"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Class.get_methods</span></code></a> method has been deprecated since Python 3.14.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/sys.html#module-sys" title="sys: Access system-specific parameters and functions."><code class="xref py py-mod docutils literal notranslate"><span class="pre">sys</span></code></a>:</p> <ul> <li><p>The <a class="reference internal" href="../library/sys.html#sys._enablelegacywindowsfsencoding" title="sys._enablelegacywindowsfsencoding"><code class="xref py py-func docutils literal notranslate"><span class="pre">_enablelegacywindowsfsencoding()</span></code></a> function has been deprecated since Python 3.13. Use the <span class="target" id="index-1"></span><a class="reference internal" href="../using/cmdline.html#envvar-PYTHONLEGACYWINDOWSFSENCODING"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONLEGACYWINDOWSFSENCODING</span></code></a> environment variable instead.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/tarfile.html#module-tarfile" title="tarfile: Read and write tar-format archive files."><code class="xref py py-mod docutils literal notranslate"><span class="pre">tarfile</span></code></a>:</p> <ul> <li><p>The undocumented and unused <code class="xref py py-attr docutils literal notranslate"><span class="pre">TarFile.tarfile</span></code> attribute has been deprecated since Python 3.13.</p></li> </ul> </li> </ul> </section> <section id="pending-removal-in-future-versions"> <h2>Pending Removal in Future Versions<a class="headerlink" href="#pending-removal-in-future-versions" title="Link to this heading">¶</a></h2> <p>The following APIs will be removed in the future, although there is currently no date scheduled for their removal.</p> <ul class="simple"> <li><p><a class="reference internal" href="../library/argparse.html#module-argparse" title="argparse: Command-line option and argument parsing library."><code class="xref py py-mod docutils literal notranslate"><span class="pre">argparse</span></code></a>: Nesting argument groups and nesting mutually exclusive groups are deprecated.</p></li> <li><p><a class="reference internal" href="../library/array.html#module-array" title="array: Space efficient arrays of uniformly typed numeric values."><code class="xref py py-mod docutils literal notranslate"><span class="pre">array</span></code></a>’s <code class="docutils literal notranslate"><span class="pre">'u'</span></code> format code (<a class="reference external" href="https://github.com/python/cpython/issues/57281">gh-57281</a>)</p></li> <li><p><a class="reference internal" href="../library/builtins.html#module-builtins" title="builtins: The module that provides the built-in namespace."><code class="xref py py-mod docutils literal notranslate"><span class="pre">builtins</span></code></a>:</p> <ul> <li><p><code class="docutils literal notranslate"><span class="pre">bool(NotImplemented)</span></code>.</p></li> <li><p>Generators: <code class="docutils literal notranslate"><span class="pre">throw(type,</span> <span class="pre">exc,</span> <span class="pre">tb)</span></code> and <code class="docutils literal notranslate"><span class="pre">athrow(type,</span> <span class="pre">exc,</span> <span class="pre">tb)</span></code> signature is deprecated: use <code class="docutils literal notranslate"><span class="pre">throw(exc)</span></code> and <code class="docutils literal notranslate"><span class="pre">athrow(exc)</span></code> instead, the single argument signature.</p></li> <li><p>Currently Python accepts numeric literals immediately followed by keywords, for example <code class="docutils literal notranslate"><span class="pre">0in</span> <span class="pre">x</span></code>, <code class="docutils literal notranslate"><span class="pre">1or</span> <span class="pre">x</span></code>, <code class="docutils literal notranslate"><span class="pre">0if</span> <span class="pre">1else</span> <span class="pre">2</span></code>. It allows confusing and ambiguous expressions like <code class="docutils literal notranslate"><span class="pre">[0x1for</span> <span class="pre">x</span> <span class="pre">in</span> <span class="pre">y]</span></code> (which can be interpreted as <code class="docutils literal notranslate"><span class="pre">[0x1</span> <span class="pre">for</span> <span class="pre">x</span> <span class="pre">in</span> <span class="pre">y]</span></code> or <code class="docutils literal notranslate"><span class="pre">[0x1f</span> <span class="pre">or</span> <span class="pre">x</span> <span class="pre">in</span> <span class="pre">y]</span></code>). A syntax warning is raised if the numeric literal is immediately followed by one of keywords <a class="reference internal" href="../reference/expressions.html#and"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">and</span></code></a>, <a class="reference internal" href="../reference/compound_stmts.html#else"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">else</span></code></a>, <a class="reference internal" href="../reference/compound_stmts.html#for"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">for</span></code></a>, <a class="reference internal" href="../reference/compound_stmts.html#if"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">if</span></code></a>, <a class="reference internal" href="../reference/expressions.html#in"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">in</span></code></a>, <a class="reference internal" href="../reference/expressions.html#is"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">is</span></code></a> and <a class="reference internal" href="../reference/expressions.html#or"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">or</span></code></a>. In a future release it will be changed to a syntax error. (<a class="reference external" href="https://github.com/python/cpython/issues/87999">gh-87999</a>)</p></li> <li><p>Support for <code class="docutils literal notranslate"><span class="pre">__index__()</span></code> and <code class="docutils literal notranslate"><span class="pre">__int__()</span></code> method returning non-int type: these methods will be required to return an instance of a strict subclass of <a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>.</p></li> <li><p>Support for <code class="docutils literal notranslate"><span class="pre">__float__()</span></code> method returning a strict subclass of <a class="reference internal" href="../library/functions.html#float" title="float"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>: these methods will be required to return an instance of <a class="reference internal" href="../library/functions.html#float" title="float"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>.</p></li> <li><p>Support for <code class="docutils literal notranslate"><span class="pre">__complex__()</span></code> method returning a strict subclass of <a class="reference internal" href="../library/functions.html#complex" title="complex"><code class="xref py py-class docutils literal notranslate"><span class="pre">complex</span></code></a>: these methods will be required to return an instance of <a class="reference internal" href="../library/functions.html#complex" title="complex"><code class="xref py py-class docutils literal notranslate"><span class="pre">complex</span></code></a>.</p></li> <li><p>Delegation of <code class="docutils literal notranslate"><span class="pre">int()</span></code> to <code class="docutils literal notranslate"><span class="pre">__trunc__()</span></code> method.</p></li> <li><p>Passing a complex number as the <em>real</em> or <em>imag</em> argument in the <a class="reference internal" href="../library/functions.html#complex" title="complex"><code class="xref py py-func docutils literal notranslate"><span class="pre">complex()</span></code></a> constructor is now deprecated; it should only be passed as a single positional argument. (Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/109218">gh-109218</a>.)</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/calendar.html#module-calendar" title="calendar: Functions for working with calendars, including some emulation of the Unix cal program."><code class="xref py py-mod docutils literal notranslate"><span class="pre">calendar</span></code></a>: <code class="docutils literal notranslate"><span class="pre">calendar.January</span></code> and <code class="docutils literal notranslate"><span class="pre">calendar.February</span></code> constants are deprecated and replaced by <a class="reference internal" href="../library/calendar.html#calendar.JANUARY" title="calendar.JANUARY"><code class="xref py py-data docutils literal notranslate"><span class="pre">calendar.JANUARY</span></code></a> and <a class="reference internal" href="../library/calendar.html#calendar.FEBRUARY" title="calendar.FEBRUARY"><code class="xref py py-data docutils literal notranslate"><span class="pre">calendar.FEBRUARY</span></code></a>. (Contributed by Prince Roshan in <a class="reference external" href="https://github.com/python/cpython/issues/103636">gh-103636</a>.)</p></li> <li><p><a class="reference internal" href="../reference/datamodel.html#codeobject.co_lnotab" title="codeobject.co_lnotab"><code class="xref py py-attr docutils literal notranslate"><span class="pre">codeobject.co_lnotab</span></code></a>: use the <a class="reference internal" href="../reference/datamodel.html#codeobject.co_lines" title="codeobject.co_lines"><code class="xref py py-meth docutils literal notranslate"><span class="pre">codeobject.co_lines()</span></code></a> method instead.</p></li> <li><p><a class="reference internal" href="../library/datetime.html#module-datetime" title="datetime: Basic date and time types."><code class="xref py py-mod docutils literal notranslate"><span class="pre">datetime</span></code></a>:</p> <ul> <li><p><a class="reference internal" href="../library/datetime.html#datetime.datetime.utcnow" title="datetime.datetime.utcnow"><code class="xref py py-meth docutils literal notranslate"><span class="pre">utcnow()</span></code></a>: use <code class="docutils literal notranslate"><span class="pre">datetime.datetime.now(tz=datetime.UTC)</span></code>.</p></li> <li><p><a class="reference internal" href="../library/datetime.html#datetime.datetime.utcfromtimestamp" title="datetime.datetime.utcfromtimestamp"><code class="xref py py-meth docutils literal notranslate"><span class="pre">utcfromtimestamp()</span></code></a>: use <code class="docutils literal notranslate"><span class="pre">datetime.datetime.fromtimestamp(timestamp,</span> <span class="pre">tz=datetime.UTC)</span></code>.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/gettext.html#module-gettext" title="gettext: Multilingual internationalization services."><code class="xref py py-mod docutils literal notranslate"><span class="pre">gettext</span></code></a>: Plural value must be an integer.</p></li> <li><p><a class="reference internal" href="../library/importlib.html#module-importlib" title="importlib: The implementation of the import machinery."><code class="xref py py-mod docutils literal notranslate"><span class="pre">importlib</span></code></a>:</p> <ul> <li><p><code class="docutils literal notranslate"><span class="pre">load_module()</span></code> method: use <code class="docutils literal notranslate"><span class="pre">exec_module()</span></code> instead.</p></li> <li><p><a class="reference internal" href="../library/importlib.html#importlib.util.cache_from_source" title="importlib.util.cache_from_source"><code class="xref py py-func docutils literal notranslate"><span class="pre">cache_from_source()</span></code></a> <em>debug_override</em> parameter is deprecated: use the <em>optimization</em> parameter instead.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/importlib.metadata.html#module-importlib.metadata" title="importlib.metadata: Accessing package metadata"><code class="xref py py-mod docutils literal notranslate"><span class="pre">importlib.metadata</span></code></a>:</p> <ul> <li><p><code class="docutils literal notranslate"><span class="pre">EntryPoints</span></code> tuple interface.</p></li> <li><p>Implicit <code class="docutils literal notranslate"><span class="pre">None</span></code> on return values.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/logging.html#module-logging" title="logging: Flexible event logging system for applications."><code class="xref py py-mod docutils literal notranslate"><span class="pre">logging</span></code></a>: the <code class="docutils literal notranslate"><span class="pre">warn()</span></code> method has been deprecated since Python 3.3, use <a class="reference internal" href="../library/logging.html#logging.warning" title="logging.warning"><code class="xref py py-meth docutils literal notranslate"><span class="pre">warning()</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../library/mailbox.html#module-mailbox" title="mailbox: Manipulate mailboxes in various formats"><code class="xref py py-mod docutils literal notranslate"><span class="pre">mailbox</span></code></a>: Use of StringIO input and text mode is deprecated, use BytesIO and binary mode instead.</p></li> <li><p><a class="reference internal" href="../library/os.html#module-os" title="os: Miscellaneous operating system interfaces."><code class="xref py py-mod docutils literal notranslate"><span class="pre">os</span></code></a>: Calling <a class="reference internal" href="../library/os.html#os.register_at_fork" title="os.register_at_fork"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.register_at_fork()</span></code></a> in multi-threaded process.</p></li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">pydoc.ErrorDuringImport</span></code>: A tuple value for <em>exc_info</em> parameter is deprecated, use an exception instance.</p></li> <li><p><a class="reference internal" href="../library/re.html#module-re" title="re: Regular expression operations."><code class="xref py py-mod docutils literal notranslate"><span class="pre">re</span></code></a>: 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 <a class="reference external" href="https://github.com/python/cpython/issues/91760">gh-91760</a>.)</p></li> <li><p><code class="xref py py-mod docutils literal notranslate"><span class="pre">sre_compile</span></code>, <code class="xref py py-mod docutils literal notranslate"><span class="pre">sre_constants</span></code> and <code class="xref py py-mod docutils literal notranslate"><span class="pre">sre_parse</span></code> modules.</p></li> <li><p><a class="reference internal" href="../library/shutil.html#module-shutil" title="shutil: High-level file operations, including copying."><code class="xref py py-mod docutils literal notranslate"><span class="pre">shutil</span></code></a>: <a class="reference internal" href="../library/shutil.html#shutil.rmtree" title="shutil.rmtree"><code class="xref py py-func docutils literal notranslate"><span class="pre">rmtree()</span></code></a>’s <em>onerror</em> parameter is deprecated in Python 3.12; use the <em>onexc</em> parameter instead.</p></li> <li><p><a class="reference internal" href="../library/ssl.html#module-ssl" title="ssl: TLS/SSL wrapper for socket objects"><code class="xref py py-mod docutils literal notranslate"><span class="pre">ssl</span></code></a> options and protocols:</p> <ul> <li><p><a class="reference internal" href="../library/ssl.html#ssl.SSLContext" title="ssl.SSLContext"><code class="xref py py-class docutils literal notranslate"><span class="pre">ssl.SSLContext</span></code></a> without protocol argument is deprecated.</p></li> <li><p><a class="reference internal" href="../library/ssl.html#ssl.SSLContext" title="ssl.SSLContext"><code class="xref py py-class docutils literal notranslate"><span class="pre">ssl.SSLContext</span></code></a>: <a class="reference internal" href="../library/ssl.html#ssl.SSLContext.set_npn_protocols" title="ssl.SSLContext.set_npn_protocols"><code class="xref py py-meth docutils literal notranslate"><span class="pre">set_npn_protocols()</span></code></a> and <code class="xref py py-meth docutils literal notranslate"><span class="pre">selected_npn_protocol()</span></code> are deprecated: use ALPN instead.</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">ssl.OP_NO_SSL*</span></code> options</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">ssl.OP_NO_TLS*</span></code> options</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">ssl.PROTOCOL_SSLv3</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">ssl.PROTOCOL_TLS</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">ssl.PROTOCOL_TLSv1</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">ssl.PROTOCOL_TLSv1_1</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">ssl.PROTOCOL_TLSv1_2</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">ssl.TLSVersion.SSLv3</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">ssl.TLSVersion.TLSv1</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">ssl.TLSVersion.TLSv1_1</span></code></p></li> </ul> </li> <li><p><a class="reference internal" href="../library/sysconfig.html#sysconfig.is_python_build" title="sysconfig.is_python_build"><code class="xref py py-func docutils literal notranslate"><span class="pre">sysconfig.is_python_build()</span></code></a> <em>check_home</em> parameter is deprecated and ignored.</p></li> <li><p><a class="reference internal" href="../library/threading.html#module-threading" title="threading: Thread-based parallelism."><code class="xref py py-mod docutils literal notranslate"><span class="pre">threading</span></code></a> methods:</p> <ul> <li><p><code class="xref py py-meth docutils literal notranslate"><span class="pre">threading.Condition.notifyAll()</span></code>: use <a class="reference internal" href="../library/threading.html#threading.Condition.notify_all" title="threading.Condition.notify_all"><code class="xref py py-meth docutils literal notranslate"><span class="pre">notify_all()</span></code></a>.</p></li> <li><p><code class="xref py py-meth docutils literal notranslate"><span class="pre">threading.Event.isSet()</span></code>: use <a class="reference internal" href="../library/threading.html#threading.Event.is_set" title="threading.Event.is_set"><code class="xref py py-meth docutils literal notranslate"><span class="pre">is_set()</span></code></a>.</p></li> <li><p><code class="xref py py-meth docutils literal notranslate"><span class="pre">threading.Thread.isDaemon()</span></code>, <a class="reference internal" href="../library/threading.html#threading.Thread.setDaemon" title="threading.Thread.setDaemon"><code class="xref py py-meth docutils literal notranslate"><span class="pre">threading.Thread.setDaemon()</span></code></a>: use <a class="reference internal" href="../library/threading.html#threading.Thread.daemon" title="threading.Thread.daemon"><code class="xref py py-attr docutils literal notranslate"><span class="pre">threading.Thread.daemon</span></code></a> attribute.</p></li> <li><p><code class="xref py py-meth docutils literal notranslate"><span class="pre">threading.Thread.getName()</span></code>, <a class="reference internal" href="../library/threading.html#threading.Thread.setName" title="threading.Thread.setName"><code class="xref py py-meth docutils literal notranslate"><span class="pre">threading.Thread.setName()</span></code></a>: use <a class="reference internal" href="../library/threading.html#threading.Thread.name" title="threading.Thread.name"><code class="xref py py-attr docutils literal notranslate"><span class="pre">threading.Thread.name</span></code></a> attribute.</p></li> <li><p><code class="xref py py-meth docutils literal notranslate"><span class="pre">threading.currentThread()</span></code>: use <a class="reference internal" href="../library/threading.html#threading.current_thread" title="threading.current_thread"><code class="xref py py-meth docutils literal notranslate"><span class="pre">threading.current_thread()</span></code></a>.</p></li> <li><p><code class="xref py py-meth docutils literal notranslate"><span class="pre">threading.activeCount()</span></code>: use <a class="reference internal" href="../library/threading.html#threading.active_count" title="threading.active_count"><code class="xref py py-meth docutils literal notranslate"><span class="pre">threading.active_count()</span></code></a>.</p></li> </ul> </li> <li><p><a class="reference internal" href="../library/typing.html#typing.Text" title="typing.Text"><code class="xref py py-class docutils literal notranslate"><span class="pre">typing.Text</span></code></a> (<a class="reference external" href="https://github.com/python/cpython/issues/92332">gh-92332</a>).</p></li> <li><p><a class="reference internal" href="../library/unittest.html#unittest.IsolatedAsyncioTestCase" title="unittest.IsolatedAsyncioTestCase"><code class="xref py py-class docutils literal notranslate"><span class="pre">unittest.IsolatedAsyncioTestCase</span></code></a>: it is deprecated to return a value that is not <code class="docutils literal notranslate"><span class="pre">None</span></code> from a test case.</p></li> <li><p><a class="reference internal" href="../library/urllib.parse.html#module-urllib.parse" title="urllib.parse: Parse URLs into or assemble them from components."><code class="xref py py-mod docutils literal notranslate"><span class="pre">urllib.parse</span></code></a> deprecated functions: <a class="reference internal" href="../library/urllib.parse.html#urllib.parse.urlparse" title="urllib.parse.urlparse"><code class="xref py py-func docutils literal notranslate"><span class="pre">urlparse()</span></code></a> instead</p> <ul> <li><p><code class="docutils literal notranslate"><span class="pre">splitattr()</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">splithost()</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">splitnport()</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">splitpasswd()</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">splitport()</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">splitquery()</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">splittag()</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">splittype()</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">splituser()</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">splitvalue()</span></code></p></li> <li><p><code class="docutils literal notranslate"><span class="pre">to_bytes()</span></code></p></li> </ul> </li> <li><p><a class="reference internal" href="../library/urllib.request.html#module-urllib.request" title="urllib.request: Extensible library for opening URLs."><code class="xref py py-mod docutils literal notranslate"><span class="pre">urllib.request</span></code></a>: <a class="reference internal" href="../library/urllib.request.html#urllib.request.URLopener" title="urllib.request.URLopener"><code class="xref py py-class docutils literal notranslate"><span class="pre">URLopener</span></code></a> and <a class="reference internal" href="../library/urllib.request.html#urllib.request.FancyURLopener" title="urllib.request.FancyURLopener"><code class="xref py py-class docutils literal notranslate"><span class="pre">FancyURLopener</span></code></a> style of invoking requests is deprecated. Use newer <a class="reference internal" href="../library/urllib.request.html#urllib.request.urlopen" title="urllib.request.urlopen"><code class="xref py py-func docutils literal notranslate"><span class="pre">urlopen()</span></code></a> functions and methods.</p></li> <li><p><a class="reference internal" href="../library/wsgiref.html#module-wsgiref" title="wsgiref: WSGI Utilities and Reference Implementation."><code class="xref py py-mod docutils literal notranslate"><span class="pre">wsgiref</span></code></a>: <code class="docutils literal notranslate"><span class="pre">SimpleHandler.stdout.write()</span></code> should not do partial writes.</p></li> <li><p><a class="reference internal" href="../library/xml.etree.elementtree.html#module-xml.etree.ElementTree" title="xml.etree.ElementTree: Implementation of the ElementTree API."><code class="xref py py-mod docutils literal notranslate"><span class="pre">xml.etree.ElementTree</span></code></a>: Testing the truth value of an <a class="reference internal" href="../library/xml.etree.elementtree.html#xml.etree.ElementTree.Element" title="xml.etree.ElementTree.Element"><code class="xref py py-class docutils literal notranslate"><span class="pre">Element</span></code></a> is deprecated. In a future release it will always return <code class="docutils literal notranslate"><span class="pre">True</span></code>. Prefer explicit <code class="docutils literal notranslate"><span class="pre">len(elem)</span></code> or <code class="docutils literal notranslate"><span class="pre">elem</span> <span class="pre">is</span> <span class="pre">not</span> <span class="pre">None</span></code> tests instead.</p></li> <li><p><a class="reference internal" href="../library/zipimport.html#zipimport.zipimporter.load_module" title="zipimport.zipimporter.load_module"><code class="xref py py-meth docutils literal notranslate"><span class="pre">zipimport.zipimporter.load_module()</span></code></a> is deprecated: use <a class="reference internal" href="../library/zipimport.html#zipimport.zipimporter.exec_module" title="zipimport.zipimporter.exec_module"><code class="xref py py-meth docutils literal notranslate"><span class="pre">exec_module()</span></code></a> instead.</p></li> </ul> </section> <section id="c-api-deprecations"> <h2>C API Deprecations<a class="headerlink" href="#c-api-deprecations" title="Link to this heading">¶</a></h2> <section id="id1"> <h3>Pending Removal in Python 3.14<a class="headerlink" href="#id1" title="Link to this heading">¶</a></h3> <ul> <li><p>The <code class="docutils literal notranslate"><span class="pre">ma_version_tag</span></code> field in <a class="reference internal" href="../c-api/dict.html#c.PyDictObject" title="PyDictObject"><code class="xref c c-type docutils literal notranslate"><span class="pre">PyDictObject</span></code></a> for extension modules (<span class="target" id="index-2"></span><a class="pep reference external" href="https://peps.python.org/pep-0699/"><strong>PEP 699</strong></a>; <a class="reference external" href="https://github.com/python/cpython/issues/101193">gh-101193</a>).</p></li> <li><p>Creating <a class="reference internal" href="../c-api/typeobj.html#c.Py_TPFLAGS_IMMUTABLETYPE" title="Py_TPFLAGS_IMMUTABLETYPE"><code class="xref c c-data docutils literal notranslate"><span class="pre">immutable</span> <span class="pre">types</span></code></a> with mutable bases (<a class="reference external" href="https://github.com/python/cpython/issues/95388">gh-95388</a>).</p></li> <li><p>Functions to configure Python’s initialization, deprecated in Python 3.11:</p> <ul class="simple"> <li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">PySys_SetArgvEx()</span></code>: Set <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.argv" title="PyConfig.argv"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.argv</span></code></a> instead.</p></li> <li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">PySys_SetArgv()</span></code>: Set <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.argv" title="PyConfig.argv"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.argv</span></code></a> instead.</p></li> <li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_SetProgramName()</span></code>: Set <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.program_name" title="PyConfig.program_name"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.program_name</span></code></a> instead.</p></li> <li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_SetPythonHome()</span></code>: Set <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.home" title="PyConfig.home"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.home</span></code></a> instead.</p></li> </ul> <p>The <a class="reference internal" href="../c-api/init.html#c.Py_InitializeFromConfig" title="Py_InitializeFromConfig"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_InitializeFromConfig()</span></code></a> API should be used with <a class="reference internal" href="../c-api/init_config.html#c.PyConfig" title="PyConfig"><code class="xref c c-type docutils literal notranslate"><span class="pre">PyConfig</span></code></a> instead.</p> </li> <li><p>Global configuration variables:</p> <ul class="simple"> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_DebugFlag" title="Py_DebugFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_DebugFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.parser_debug" title="PyConfig.parser_debug"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.parser_debug</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_VerboseFlag" title="Py_VerboseFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_VerboseFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.verbose" title="PyConfig.verbose"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.verbose</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_QuietFlag" title="Py_QuietFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_QuietFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.quiet" title="PyConfig.quiet"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.quiet</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_InteractiveFlag" title="Py_InteractiveFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_InteractiveFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.interactive" title="PyConfig.interactive"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.interactive</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_InspectFlag" title="Py_InspectFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_InspectFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.inspect" title="PyConfig.inspect"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.inspect</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_OptimizeFlag" title="Py_OptimizeFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_OptimizeFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.optimization_level" title="PyConfig.optimization_level"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.optimization_level</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_NoSiteFlag" title="Py_NoSiteFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_NoSiteFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.site_import" title="PyConfig.site_import"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.site_import</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_BytesWarningFlag" title="Py_BytesWarningFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_BytesWarningFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.bytes_warning" title="PyConfig.bytes_warning"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.bytes_warning</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_FrozenFlag" title="Py_FrozenFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_FrozenFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.pathconfig_warnings" title="PyConfig.pathconfig_warnings"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.pathconfig_warnings</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_IgnoreEnvironmentFlag" title="Py_IgnoreEnvironmentFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_IgnoreEnvironmentFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.use_environment" title="PyConfig.use_environment"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.use_environment</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_DontWriteBytecodeFlag" title="Py_DontWriteBytecodeFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_DontWriteBytecodeFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.write_bytecode" title="PyConfig.write_bytecode"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.write_bytecode</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_NoUserSiteDirectory" title="Py_NoUserSiteDirectory"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_NoUserSiteDirectory</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.user_site_directory" title="PyConfig.user_site_directory"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.user_site_directory</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_UnbufferedStdioFlag" title="Py_UnbufferedStdioFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_UnbufferedStdioFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.buffered_stdio" title="PyConfig.buffered_stdio"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.buffered_stdio</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_HashRandomizationFlag" title="Py_HashRandomizationFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_HashRandomizationFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.use_hash_seed" title="PyConfig.use_hash_seed"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.use_hash_seed</span></code></a> and <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.hash_seed" title="PyConfig.hash_seed"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.hash_seed</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_IsolatedFlag" title="Py_IsolatedFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_IsolatedFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.isolated" title="PyConfig.isolated"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.isolated</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_LegacyWindowsFSEncodingFlag" title="Py_LegacyWindowsFSEncodingFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_LegacyWindowsFSEncodingFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyPreConfig.legacy_windows_fs_encoding" title="PyPreConfig.legacy_windows_fs_encoding"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyPreConfig.legacy_windows_fs_encoding</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_LegacyWindowsStdioFlag" title="Py_LegacyWindowsStdioFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_LegacyWindowsStdioFlag</span></code></a>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.legacy_windows_stdio" title="PyConfig.legacy_windows_stdio"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.legacy_windows_stdio</span></code></a> instead.</p></li> <li><p><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_FileSystemDefaultEncoding</span></code>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.filesystem_encoding" title="PyConfig.filesystem_encoding"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.filesystem_encoding</span></code></a> instead.</p></li> <li><p><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_HasFileSystemDefaultEncoding</span></code>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.filesystem_encoding" title="PyConfig.filesystem_encoding"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.filesystem_encoding</span></code></a> instead.</p></li> <li><p><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_FileSystemDefaultEncodeErrors</span></code>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.filesystem_errors" title="PyConfig.filesystem_errors"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.filesystem_errors</span></code></a> instead.</p></li> <li><p><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_UTF8Mode</span></code>: Use <a class="reference internal" href="../c-api/init_config.html#c.PyPreConfig.utf8_mode" title="PyPreConfig.utf8_mode"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyPreConfig.utf8_mode</span></code></a> instead. (see <a class="reference internal" href="../c-api/init_config.html#c.Py_PreInitialize" title="Py_PreInitialize"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_PreInitialize()</span></code></a>)</p></li> </ul> <p>The <a class="reference internal" href="../c-api/init.html#c.Py_InitializeFromConfig" title="Py_InitializeFromConfig"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_InitializeFromConfig()</span></code></a> API should be used with <a class="reference internal" href="../c-api/init_config.html#c.PyConfig" title="PyConfig"><code class="xref c c-type docutils literal notranslate"><span class="pre">PyConfig</span></code></a> instead.</p> </li> </ul> </section> <section id="id2"> <h3>Pending Removal in Python 3.15<a class="headerlink" href="#id2" title="Link to this heading">¶</a></h3> <ul class="simple"> <li><p>The bundled copy of <code class="docutils literal notranslate"><span class="pre">libmpdecimal</span></code>.</p></li> <li><p>The <a class="reference internal" href="../c-api/import.html#c.PyImport_ImportModuleNoBlock" title="PyImport_ImportModuleNoBlock"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyImport_ImportModuleNoBlock()</span></code></a>: Use <a class="reference internal" href="../c-api/import.html#c.PyImport_ImportModule" title="PyImport_ImportModule"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyImport_ImportModule()</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/weakref.html#c.PyWeakref_GetObject" title="PyWeakref_GetObject"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyWeakref_GetObject()</span></code></a> and <a class="reference internal" href="../c-api/weakref.html#c.PyWeakref_GET_OBJECT" title="PyWeakref_GET_OBJECT"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyWeakref_GET_OBJECT()</span></code></a>: Use <a class="reference internal" href="../c-api/weakref.html#c.PyWeakref_GetRef" title="PyWeakref_GetRef"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyWeakref_GetRef()</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/unicode.html#c.Py_UNICODE" title="Py_UNICODE"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_UNICODE</span></code></a> type and the <code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_UNICODE_WIDE</span></code> macro: Use <code class="xref c c-type docutils literal notranslate"><span class="pre">wchar_t</span></code> instead.</p></li> <li><p>Python initialization functions:</p> <ul> <li><p><a class="reference internal" href="../c-api/sys.html#c.PySys_ResetWarnOptions" title="PySys_ResetWarnOptions"><code class="xref c c-func docutils literal notranslate"><span class="pre">PySys_ResetWarnOptions()</span></code></a>: Clear <a class="reference internal" href="../library/sys.html#sys.warnoptions" title="sys.warnoptions"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.warnoptions</span></code></a> and <code class="xref py py-data docutils literal notranslate"><span class="pre">warnings.filters</span></code> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_GetExecPrefix" title="Py_GetExecPrefix"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetExecPrefix()</span></code></a>: Get <a class="reference internal" href="../library/sys.html#sys.base_exec_prefix" title="sys.base_exec_prefix"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.base_exec_prefix</span></code></a> and <a class="reference internal" href="../library/sys.html#sys.exec_prefix" title="sys.exec_prefix"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.exec_prefix</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_GetPath" title="Py_GetPath"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetPath()</span></code></a>: Get <a class="reference internal" href="../library/sys.html#sys.path" title="sys.path"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.path</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_GetPrefix" title="Py_GetPrefix"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetPrefix()</span></code></a>: Get <a class="reference internal" href="../library/sys.html#sys.base_prefix" title="sys.base_prefix"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.base_prefix</span></code></a> and <a class="reference internal" href="../library/sys.html#sys.prefix" title="sys.prefix"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.prefix</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_GetProgramFullPath" title="Py_GetProgramFullPath"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetProgramFullPath()</span></code></a>: Get <a class="reference internal" href="../library/sys.html#sys.executable" title="sys.executable"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.executable</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_GetProgramName" title="Py_GetProgramName"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetProgramName()</span></code></a>: Get <a class="reference internal" href="../library/sys.html#sys.executable" title="sys.executable"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.executable</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.Py_GetPythonHome" title="Py_GetPythonHome"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetPythonHome()</span></code></a>: Get <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.home" title="PyConfig.home"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.home</span></code></a> or the <span class="target" id="index-3"></span><a class="reference internal" href="../using/cmdline.html#envvar-PYTHONHOME"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONHOME</span></code></a> environment variable instead.</p></li> </ul> </li> </ul> </section> <section id="id3"> <h3>Pending Removal in Future Versions<a class="headerlink" href="#id3" title="Link to this heading">¶</a></h3> <p>The following APIs are deprecated and will be removed, although there is currently no date scheduled for their removal.</p> <ul class="simple"> <li><p><a class="reference internal" href="../c-api/typeobj.html#c.Py_TPFLAGS_HAVE_FINALIZE" title="Py_TPFLAGS_HAVE_FINALIZE"><code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_TPFLAGS_HAVE_FINALIZE</span></code></a>: Unneeded since Python 3.8.</p></li> <li><p><a class="reference internal" href="../c-api/exceptions.html#c.PyErr_Fetch" title="PyErr_Fetch"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyErr_Fetch()</span></code></a>: Use <a class="reference internal" href="../c-api/exceptions.html#c.PyErr_GetRaisedException" title="PyErr_GetRaisedException"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyErr_GetRaisedException()</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/exceptions.html#c.PyErr_NormalizeException" title="PyErr_NormalizeException"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyErr_NormalizeException()</span></code></a>: Use <a class="reference internal" href="../c-api/exceptions.html#c.PyErr_GetRaisedException" title="PyErr_GetRaisedException"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyErr_GetRaisedException()</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/exceptions.html#c.PyErr_Restore" title="PyErr_Restore"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyErr_Restore()</span></code></a>: Use <a class="reference internal" href="../c-api/exceptions.html#c.PyErr_SetRaisedException" title="PyErr_SetRaisedException"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyErr_SetRaisedException()</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/module.html#c.PyModule_GetFilename" title="PyModule_GetFilename"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyModule_GetFilename()</span></code></a>: Use <a class="reference internal" href="../c-api/module.html#c.PyModule_GetFilenameObject" title="PyModule_GetFilenameObject"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyModule_GetFilenameObject()</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/sys.html#c.PyOS_AfterFork" title="PyOS_AfterFork"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyOS_AfterFork()</span></code></a>: Use <a class="reference internal" href="../c-api/sys.html#c.PyOS_AfterFork_Child" title="PyOS_AfterFork_Child"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyOS_AfterFork_Child()</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/slice.html#c.PySlice_GetIndicesEx" title="PySlice_GetIndicesEx"><code class="xref c c-func docutils literal notranslate"><span class="pre">PySlice_GetIndicesEx()</span></code></a>: Use <a class="reference internal" href="../c-api/slice.html#c.PySlice_Unpack" title="PySlice_Unpack"><code class="xref c c-func docutils literal notranslate"><span class="pre">PySlice_Unpack()</span></code></a> and <a class="reference internal" href="../c-api/slice.html#c.PySlice_AdjustIndices" title="PySlice_AdjustIndices"><code class="xref c c-func docutils literal notranslate"><span class="pre">PySlice_AdjustIndices()</span></code></a> instead.</p></li> <li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicode_AsDecodedObject()</span></code>: Use <a class="reference internal" href="../c-api/codec.html#c.PyCodec_Decode" title="PyCodec_Decode"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyCodec_Decode()</span></code></a> instead.</p></li> <li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicode_AsDecodedUnicode()</span></code>: Use <a class="reference internal" href="../c-api/codec.html#c.PyCodec_Decode" title="PyCodec_Decode"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyCodec_Decode()</span></code></a> instead.</p></li> <li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicode_AsEncodedObject()</span></code>: Use <a class="reference internal" href="../c-api/codec.html#c.PyCodec_Encode" title="PyCodec_Encode"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyCodec_Encode()</span></code></a> instead.</p></li> <li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicode_AsEncodedUnicode()</span></code>: Use <a class="reference internal" href="../c-api/codec.html#c.PyCodec_Encode" title="PyCodec_Encode"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyCodec_Encode()</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/unicode.html#c.PyUnicode_READY" title="PyUnicode_READY"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicode_READY()</span></code></a>: Unneeded since Python 3.12</p></li> <li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">PyErr_Display()</span></code>: Use <a class="reference internal" href="../c-api/exceptions.html#c.PyErr_DisplayException" title="PyErr_DisplayException"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyErr_DisplayException()</span></code></a> instead.</p></li> <li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyErr_ChainExceptions()</span></code>: Use <code class="xref c c-func docutils literal notranslate"><span class="pre">_PyErr_ChainExceptions1()</span></code> instead.</p></li> <li><p><code class="xref c c-member docutils literal notranslate"><span class="pre">PyBytesObject.ob_shash</span></code> member: call <a class="reference internal" href="../c-api/object.html#c.PyObject_Hash" title="PyObject_Hash"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyObject_Hash()</span></code></a> instead.</p></li> <li><p><code class="xref c c-member docutils literal notranslate"><span class="pre">PyDictObject.ma_version_tag</span></code> member.</p></li> <li><p>Thread Local Storage (TLS) API:</p> <ul> <li><p><a class="reference internal" href="../c-api/init.html#c.PyThread_create_key" title="PyThread_create_key"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_create_key()</span></code></a>: Use <a class="reference internal" href="../c-api/init.html#c.PyThread_tss_alloc" title="PyThread_tss_alloc"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_tss_alloc()</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.PyThread_delete_key" title="PyThread_delete_key"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_delete_key()</span></code></a>: Use <a class="reference internal" href="../c-api/init.html#c.PyThread_tss_free" title="PyThread_tss_free"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_tss_free()</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.PyThread_set_key_value" title="PyThread_set_key_value"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_set_key_value()</span></code></a>: Use <a class="reference internal" href="../c-api/init.html#c.PyThread_tss_set" title="PyThread_tss_set"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_tss_set()</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.PyThread_get_key_value" title="PyThread_get_key_value"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_get_key_value()</span></code></a>: Use <a class="reference internal" href="../c-api/init.html#c.PyThread_tss_get" title="PyThread_tss_get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_tss_get()</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.PyThread_delete_key_value" title="PyThread_delete_key_value"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_delete_key_value()</span></code></a>: Use <a class="reference internal" href="../c-api/init.html#c.PyThread_tss_delete" title="PyThread_tss_delete"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_tss_delete()</span></code></a> instead.</p></li> <li><p><a class="reference internal" href="../c-api/init.html#c.PyThread_ReInitTLS" title="PyThread_ReInitTLS"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_ReInitTLS()</span></code></a>: Unneeded since Python 3.7.</p></li> </ul> </li> </ul> </section> </section> </section> <div class="clearer"></div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="Main"> <div class="sphinxsidebarwrapper"> <div> <h3><a href="../contents.html">Table of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Deprecations</a><ul> <li><a class="reference internal" href="#pending-removal-in-python-3-14">Pending Removal in Python 3.14</a></li> <li><a class="reference internal" href="#pending-removal-in-python-3-15">Pending Removal in Python 3.15</a></li> <li><a class="reference internal" href="#pending-removal-in-python-3-16">Pending removal in Python 3.16</a></li> <li><a class="reference internal" href="#pending-removal-in-future-versions">Pending Removal in Future Versions</a></li> <li><a class="reference internal" href="#c-api-deprecations">C API Deprecations</a><ul> <li><a class="reference internal" href="#id1">Pending Removal in Python 3.14</a></li> <li><a class="reference internal" href="#id2">Pending Removal in Python 3.15</a></li> <li><a class="reference internal" href="#id3">Pending Removal in Future Versions</a></li> </ul> </li> </ul> </li> </ul> </div> <div> <h4>Previous topic</h4> <p class="topless"><a href="../faq/installed.html" title="previous chapter">“Why is Python Installed on my Computer?” FAQ</a></p> </div> <div> <h4>Next topic</h4> <p class="topless"><a href="../glossary.html" title="next chapter">Glossary</a></p> </div> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../bugs.html">Report a Bug</a></li> <li> <a href="https://github.com/python/cpython/blob/main/Doc/deprecations/index.rst" rel="nofollow">Show Source </a> </li> </ul> </div> </div> <div id="sidebarbutton" title="Collapse sidebar"> <span>«</span> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="Related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="../glossary.html" title="Glossary" >next</a> |</li> <li class="right" > <a href="../faq/installed.html" title="“Why is Python Installed on my Computer?” FAQ" >previous</a> |</li> <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="https://www.python.org/">Python</a> »</li> <li class="switchers"> <div class="language_switcher_placeholder"></div> <div class="version_switcher_placeholder"></div> </li> <li> </li> <li id="cpython-language-and-version"> <a href="../index.html">3.13.0 Documentation</a> » </li> <li class="nav-item nav-item-this"><a href="">Deprecations</a></li> <li class="right"> <div class="inline-search" role="search"> <form class="inline-search" action="../search.html" method="get"> <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" /> <input type="submit" value="Go" /> </form> </div> | </li> <li class="right"> <label class="theme-selector-label"> Theme <select class="theme-selector" oninput="activateTheme(this.value)"> <option value="auto" selected>Auto</option> <option value="light">Light</option> <option value="dark">Dark</option> </select> </label> |</li> </ul> </div> <div class="footer"> © <a href="../copyright.html"> Copyright </a> 2001-2024, Python Software Foundation. <br /> This page is licensed under the Python Software Foundation License Version 2. <br /> Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License. <br /> See <a href="/license.html">History and License</a> for more information.<br /> <br /> The Python Software Foundation is a non-profit corporation. <a href="https://www.python.org/psf/donations/">Please donate.</a> <br /> <br /> Last updated on Nov 24, 2024 (17:50 UTC). <a href="/bugs.html">Found a bug</a>? <br /> Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.1.3. </div> <script type="text/javascript" src="../_static/switchers.js"></script> </body> </html>