Files
FootPrint/Python/pythoncore-3.15-64/Doc/html/deprecations/index.html
T

1168 lines
134 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!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.16: The import system:- Setting__loader__ on a module while failing to set__spec__.loader is deprecated. In Python 3.16,__loader__ will cease to be set or taken into con..." />
<meta property="og:image" content="_static/og-image.png" />
<meta property="og:image:alt" content="Python documentation" />
<meta name="description" content="Pending removal in Python 3.16: The import system:- Setting__loader__ on a module while failing to set__spec__.loader is deprecated. In Python 3.16,__loader__ will cease to be set or taken into con..." />
<meta name="theme-color" content="#3776ab">
<meta property="og:image:width" content="200">
<meta property="og:image:height" content="200">
<title>Deprecations &#8212; Python 3.15.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=b86133f3" />
<link rel="stylesheet" type="text/css" href="../_static/classic.css?v=234b1a7c" />
<link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=48df1187" />
<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=0fc419ee" />
<script src="../_static/documentation_options.js?v=0fe728b1"></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.15.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" />
<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-16">Pending removal in Python 3.16</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-17">Pending removal in Python 3.17</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-18">Pending removal in Python 3.18</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-19">Pending removal in Python 3.19</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-20">Pending removal in Python 3.20</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="#soft-deprecations">Soft deprecations</a></li>
<li><a class="reference internal" href="#c-api-deprecations">C API deprecations</a><ul>
<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="#id1">Pending removal in Python 3.16</a></li>
<li><a class="reference internal" href="#id2">Pending removal in Python 3.18</a></li>
<li><a class="reference internal" href="#id3">Pending removal in Python 3.19</a></li>
<li><a class="reference internal" href="#id4">Pending removal in Python 3.20</a></li>
<li><a class="reference internal" href="#id5">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>
<script>
document.addEventListener('DOMContentLoaded', () => {
const title = document.querySelector('meta[property="og:title"]').content;
const elements = document.querySelectorAll('.improvepage');
const pageurl = window.location.href.split('?')[0];
elements.forEach(element => {
const url = new URL(element.href.split('?')[0].replace("-nojs", ""));
url.searchParams.set('pagetitle', title);
url.searchParams.set('pageurl', pageurl);
url.searchParams.set('pagesource', "deprecations/index.rst");
element.href = url.toString();
});
});
</script>
<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 class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>
<li>
<a href="https://github.com/python/cpython/blob/3.15/Doc/deprecations/index.rst?plain=1"
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 class="root-icon"><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> &#187;</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.15.0 Documentation</a> &#187;
</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-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>
<li><p>The import system:</p>
<ul class="simple">
<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 class="simple">
<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>
<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> policy system is deprecated and will be removed in Python 3.16.
In particular, the following classes and functions are deprecated:</p>
<ul class="simple">
<li><p><a class="reference internal" href="../library/asyncio-policy.html#asyncio.AbstractEventLoopPolicy" title="asyncio.AbstractEventLoopPolicy"><code class="xref py py-class docutils literal notranslate"><span class="pre">asyncio.AbstractEventLoopPolicy</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/asyncio-policy.html#asyncio.DefaultEventLoopPolicy" title="asyncio.DefaultEventLoopPolicy"><code class="xref py py-class docutils literal notranslate"><span class="pre">asyncio.DefaultEventLoopPolicy</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/asyncio-policy.html#asyncio.WindowsSelectorEventLoopPolicy" title="asyncio.WindowsSelectorEventLoopPolicy"><code class="xref py py-class docutils literal notranslate"><span class="pre">asyncio.WindowsSelectorEventLoopPolicy</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/asyncio-policy.html#asyncio.WindowsProactorEventLoopPolicy" title="asyncio.WindowsProactorEventLoopPolicy"><code class="xref py py-class docutils literal notranslate"><span class="pre">asyncio.WindowsProactorEventLoopPolicy</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/asyncio-policy.html#asyncio.get_event_loop_policy" title="asyncio.get_event_loop_policy"><code class="xref py py-func docutils literal notranslate"><span class="pre">asyncio.get_event_loop_policy()</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/asyncio-policy.html#asyncio.set_event_loop_policy" title="asyncio.set_event_loop_policy"><code class="xref py py-func docutils literal notranslate"><span class="pre">asyncio.set_event_loop_policy()</span></code></a></p></li>
</ul>
<p>Users should use <a class="reference internal" href="../library/asyncio-runner.html#asyncio.run" title="asyncio.run"><code class="xref py py-func docutils literal notranslate"><span class="pre">asyncio.run()</span></code></a> or <a class="reference internal" href="../library/asyncio-runner.html#asyncio.Runner" title="asyncio.Runner"><code class="xref py py-class docutils literal notranslate"><span class="pre">asyncio.Runner</span></code></a> with
<em>loop_factory</em> to use the desired event loop implementation.</p>
<p>For example, to use <a class="reference internal" href="../library/asyncio-eventloop.html#asyncio.SelectorEventLoop" title="asyncio.SelectorEventLoop"><code class="xref py py-class docutils literal notranslate"><span class="pre">asyncio.SelectorEventLoop</span></code></a> on Windows:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span><span class="w"> </span><span class="nn">asyncio</span>
<span class="k">async</span> <span class="k">def</span><span class="w"> </span><span class="nf">main</span><span class="p">():</span>
<span class="o">...</span>
<span class="n">asyncio</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">main</span><span class="p">(),</span> <span class="n">loop_factory</span><span class="o">=</span><span class="n">asyncio</span><span class="o">.</span><span class="n">SelectorEventLoop</span><span class="p">)</span>
</pre></div>
</div>
<p>(Contributed by Kumar Aditya in <a class="reference external" href="https://github.com/python/cpython/issues/127949">gh-127949</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 class="simple">
<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/functools.html#module-functools" title="functools: Higher-order functions and operations on callable objects."><code class="xref py py-mod docutils literal notranslate"><span class="pre">functools</span></code></a>:</p>
<ul class="simple">
<li><p>Calling the Python implementation of <a class="reference internal" href="../library/functools.html#functools.reduce" title="functools.reduce"><code class="xref py py-func docutils literal notranslate"><span class="pre">functools.reduce()</span></code></a> with <em>function</em>
or <em>sequence</em> as keyword arguments has been deprecated since Python 3.14.</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>:</p>
<ul class="simple">
<li><p>Support for custom logging handlers with the <em>strm</em> argument is deprecated
and scheduled for removal in Python 3.16. Define handlers with the <em>stream</em>
argument instead. (Contributed by Mariusz Felisiak in <a class="reference external" href="https://github.com/python/cpython/issues/115032">gh-115032</a>.)</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/mimetypes.html#module-mimetypes" title="mimetypes: Mapping of filename extensions to MIME types."><code class="xref py py-mod docutils literal notranslate"><span class="pre">mimetypes</span></code></a>:</p>
<ul class="simple">
<li><p>Valid extensions start with a ‘.’ or are empty for
<a class="reference internal" href="../library/mimetypes.html#mimetypes.MimeTypes.add_type" title="mimetypes.MimeTypes.add_type"><code class="xref py py-meth docutils literal notranslate"><span class="pre">mimetypes.MimeTypes.add_type()</span></code></a>.
Undotted extensions are deprecated and will
raise a <a class="reference internal" href="../builtins/exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> in Python 3.16.
(Contributed by Hugo van Kemenade in <a class="reference external" href="https://github.com/python/cpython/issues/75223">gh-75223</a>.)</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 class="simple">
<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="../builtins/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 class="simple">
<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 class="simple">
<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-0"></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/sysconfig.html#module-sysconfig" title="sysconfig: Python's configuration information"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code></a>:</p>
<ul class="simple">
<li><p>The <code class="xref py py-func docutils literal notranslate"><span class="pre">sysconfig.expand_makefile_vars()</span></code> function
has been deprecated since Python 3.14.
Use the <code class="docutils literal notranslate"><span class="pre">vars</span></code> argument of <a class="reference internal" href="../library/sysconfig.html#sysconfig.get_paths" title="sysconfig.get_paths"><code class="xref py py-func docutils literal notranslate"><span class="pre">sysconfig.get_paths()</span></code></a> 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 class="simple">
<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-python-3-17">
<h2>Pending removal in Python 3.17<a class="headerlink" href="#pending-removal-in-python-3-17" title="Link to this heading"></a></h2>
<ul>
<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 class="simple">
<li><p><a class="reference internal" href="../library/datetime.html#datetime.datetime.strptime" title="datetime.datetime.strptime"><code class="xref py py-meth docutils literal notranslate"><span class="pre">strptime()</span></code></a> calls using a format string containing
<code class="docutils literal notranslate"><span class="pre">%e</span></code> (day of month) without a year.
This has been deprecated since Python 3.15.
(Contributed by Stan Ulbrych in <a class="reference external" href="https://github.com/python/cpython/issues/70647">gh-70647</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>:</p>
<ul>
<li><p><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">collections.abc.ByteString</span></code></a> is scheduled for removal in Python 3.17.</p>
<p>Use <code class="docutils literal notranslate"><span class="pre">isinstance(obj,</span> <span class="pre">collections.abc.Buffer)</span></code> to test if <code class="docutils literal notranslate"><span class="pre">obj</span></code>
implements the <a class="reference internal" href="../c-api/buffer.html#bufferobjects"><span class="std std-ref">buffer protocol</span></a> at runtime. For use
in type annotations, either use <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> or a union
that explicitly specifies the types your code supports (e.g.,
<code class="docutils literal notranslate"><span class="pre">bytes</span> <span class="pre">|</span> <span class="pre">bytearray</span> <span class="pre">|</span> <span class="pre">memoryview</span></code>).</p>
<p><code class="xref py py-class docutils literal notranslate"><span class="pre">ByteString</span></code> was originally intended to be an abstract class that
would serve as a supertype of both <a class="reference internal" href="../builtins/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a> and <a class="reference internal" href="../builtins/stdtypes.html#bytearray" title="bytearray"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></a>.
However, since the ABC never had any methods, knowing that an object was an
instance of <code class="xref py py-class docutils literal notranslate"><span class="pre">ByteString</span></code> never actually told you anything useful
about the object. Other common buffer types such as <a class="reference internal" href="../builtins/stdtypes.html#memoryview" title="memoryview"><code class="xref py py-class docutils literal notranslate"><span class="pre">memoryview</span></code></a>
were also never understood as subtypes of <code class="xref py py-class docutils literal notranslate"><span class="pre">ByteString</span></code> (either at
runtime or by static type checkers).</p>
<p>See <span class="target" id="index-1"></span><a class="pep reference external" href="https://peps.python.org/pep-0688/#current-options"><strong>PEP 688</strong></a> for more details.
(Contributed by Shantanu Jain in <a class="reference external" href="https://github.com/python/cpython/issues/91896">gh-91896</a>.)</p>
</li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/codecs.html#module-encodings" title="encodings: Encodings package"><code class="xref py py-mod docutils literal notranslate"><span class="pre">encodings</span></code></a>:</p>
<ul class="simple">
<li><p>Passing non-ascii <em>encoding</em> names to <a class="reference internal" href="../library/codecs.html#encodings.normalize_encoding" title="encodings.normalize_encoding"><code class="xref py py-func docutils literal notranslate"><span class="pre">encodings.normalize_encoding()</span></code></a>
is deprecated and scheduled for removal in Python 3.17.
(Contributed by Stan Ulbrych in <a class="reference external" href="https://github.com/python/cpython/issues/136702">gh-136702</a>.)</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/profile.html#module-profile" title="profile: Pure Python profiler (deprecated). (deprecated)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">profile</span></code></a>:</p>
<ul class="simple">
<li><p>The <code class="xref py py-mod docutils literal notranslate"><span class="pre">profile</span></code> module is deprecated and will be removed in
Python 3.17. Use <a class="reference internal" href="../library/profiling.tracing.html#module-profiling.tracing" title="profiling.tracing: Deterministic tracing profiler for Python programs."><code class="xref py py-mod docutils literal notranslate"><span class="pre">profiling.tracing</span></code></a> instead, which provides a
compatible API. See <span class="target" id="index-2"></span><a class="pep reference external" href="https://peps.python.org/pep-0799/"><strong>PEP 799</strong></a> for details.
(Contributed by Pablo Galindo and László Kiss Kollár in <a class="reference external" href="https://github.com/python/cpython/issues/138122">gh-138122</a>.)</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/webbrowser.html#module-webbrowser" title="webbrowser: Easy-to-use controller for web browsers."><code class="xref py py-mod docutils literal notranslate"><span class="pre">webbrowser</span></code></a>:</p>
<ul class="simple">
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">webbrowser.MacOSXOSAScript</span></code> is deprecated in favour of
<code class="xref py py-class docutils literal notranslate"><span class="pre">webbrowser.MacOS</span></code>. (<a class="reference external" href="https://github.com/python/cpython/issues/137586">gh-137586</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>Before Python 3.14, old-style unions were implemented using the private class
<code class="docutils literal notranslate"><span class="pre">typing._UnionGenericAlias</span></code>. This class is no longer needed for the implementation,
but it has been retained for backward compatibility, with removal scheduled for Python
3.17. Users should use documented introspection helpers like <a class="reference internal" href="../library/typing.html#typing.get_origin" title="typing.get_origin"><code class="xref py py-func docutils literal notranslate"><span class="pre">typing.get_origin()</span></code></a>
and <a class="reference internal" href="../library/typing.html#typing.get_args" title="typing.get_args"><code class="xref py py-func docutils literal notranslate"><span class="pre">typing.get_args()</span></code></a> instead of relying on private implementation details.</p></li>
<li><p><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">typing.ByteString</span></code></a>, deprecated since Python 3.9, is scheduled for removal in
Python 3.17.</p>
<p>Use <code class="docutils literal notranslate"><span class="pre">isinstance(obj,</span> <span class="pre">collections.abc.Buffer)</span></code> to test if <code class="docutils literal notranslate"><span class="pre">obj</span></code>
implements the <a class="reference internal" href="../c-api/buffer.html#bufferobjects"><span class="std std-ref">buffer protocol</span></a> at runtime. For use
in type annotations, either use <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> or a union
that explicitly specifies the types your code supports (e.g.,
<code class="docutils literal notranslate"><span class="pre">bytes</span> <span class="pre">|</span> <span class="pre">bytearray</span> <span class="pre">|</span> <span class="pre">memoryview</span></code>).</p>
<p><code class="xref py py-class docutils literal notranslate"><span class="pre">ByteString</span></code> was originally intended to be an abstract class that
would serve as a supertype of both <a class="reference internal" href="../builtins/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a> and <a class="reference internal" href="../builtins/stdtypes.html#bytearray" title="bytearray"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></a>.
However, since the ABC never had any methods, knowing that an object was an
instance of <code class="xref py py-class docutils literal notranslate"><span class="pre">ByteString</span></code> never actually told you anything useful
about the object. Other common buffer types such as <a class="reference internal" href="../builtins/stdtypes.html#memoryview" title="memoryview"><code class="xref py py-class docutils literal notranslate"><span class="pre">memoryview</span></code></a>
were also never understood as subtypes of <code class="xref py py-class docutils literal notranslate"><span class="pre">ByteString</span></code> (either at
runtime or by static type checkers).</p>
<p>See <span class="target" id="index-3"></span><a class="pep reference external" href="https://peps.python.org/pep-0688/#current-options"><strong>PEP 688</strong></a> for more details.
(Contributed by Shantanu Jain in <a class="reference external" href="https://github.com/python/cpython/issues/91896">gh-91896</a>.)</p>
</li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/tkinter.html#module-tkinter" title="tkinter: Interface to Tcl/Tk for graphical user interfaces"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tkinter</span></code></a>:</p>
<ul class="simple">
<li><p>The <code class="xref py py-class docutils literal notranslate"><span class="pre">tkinter.Variable</span></code> methods <code class="xref py py-meth docutils literal notranslate"><span class="pre">trace_variable()</span></code>,
<code class="xref py py-meth docutils literal notranslate"><span class="pre">trace()</span></code> (an alias of <code class="xref py py-meth docutils literal notranslate"><span class="pre">trace_variable()</span></code>),
<code class="xref py py-meth docutils literal notranslate"><span class="pre">trace_vdelete()</span></code> and <code class="xref py py-meth docutils literal notranslate"><span class="pre">trace_vinfo()</span></code>, deprecated since
Python 3.14, are scheduled for removal in Python 3.17.
Use <code class="xref py py-meth docutils literal notranslate"><span class="pre">trace_add()</span></code>, <code class="xref py py-meth docutils literal notranslate"><span class="pre">trace_remove()</span></code> and <code class="xref py py-meth docutils literal notranslate"><span class="pre">trace_info()</span></code>
instead.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/120220">gh-120220</a>.)</p></li>
</ul>
</li>
</ul>
</section>
<section id="pending-removal-in-python-3-18">
<h2>Pending removal in Python 3.18<a class="headerlink" href="#pending-removal-in-python-3-18" title="Link to this heading"></a></h2>
<ul>
<li><p>No longer accept a boolean value when a file descriptor is expected.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/82626">gh-82626</a>.)</p></li>
<li><p><a class="reference internal" href="../library/decimal.html#module-decimal" title="decimal: Implementation of the General Decimal Arithmetic Specification."><code class="xref py py-mod docutils literal notranslate"><span class="pre">decimal</span></code></a>:</p>
<ul class="simple">
<li><p>The non-standard and undocumented <a class="reference internal" href="../library/decimal.html#decimal.Decimal" title="decimal.Decimal"><code class="xref py py-class docutils literal notranslate"><span class="pre">Decimal</span></code></a> format
specifier <code class="docutils literal notranslate"><span class="pre">'N'</span></code>, which is only supported in the <code class="xref py py-mod docutils literal notranslate"><span class="pre">decimal</span></code> module’s
C implementation, has been deprecated since Python 3.13.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/89902">gh-89902</a>.)</p></li>
</ul>
</li>
<li><p>Deprecations defined by <span class="target" id="index-4"></span><a class="pep reference external" href="https://peps.python.org/pep-0829/"><strong>PEP 829</strong></a>:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">import</span></code> lines in <code class="file docutils literal notranslate"><em><span class="pre">name</span></em><span class="pre">.pth</span></code> files are silently ignored.</p></li>
</ul>
<p>(Contributed by Barry Warsaw in <a class="reference external" href="https://github.com/python/cpython/issues/148641">gh-148641</a>.)</p>
</li>
</ul>
</section>
<section id="pending-removal-in-python-3-19">
<h2>Pending removal in Python 3.19<a class="headerlink" href="#pending-removal-in-python-3-19" title="Link to this heading"></a></h2>
<ul>
<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 class="simple">
<li><p>Implicitly switching to the MSVC-compatible struct layout by setting
<a class="reference internal" href="../library/ctypes.html#ctypes.Structure._pack_" title="ctypes.Structure._pack_"><code class="xref py py-attr docutils literal notranslate"><span class="pre">_pack_</span></code></a> but not <a class="reference internal" href="../library/ctypes.html#ctypes.Structure._layout_" title="ctypes.Structure._layout_"><code class="xref py py-attr docutils literal notranslate"><span class="pre">_layout_</span></code></a>
on non-Windows platforms.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/hashlib.html#module-hashlib" title="hashlib: Secure hash and message digest algorithms."><code class="xref py py-mod docutils literal notranslate"><span class="pre">hashlib</span></code></a>:</p>
<ul>
<li><p>In hash function constructors such as <a class="reference internal" href="../library/hashlib.html#hashlib.new" title="hashlib.new"><code class="xref py py-func docutils literal notranslate"><span class="pre">new()</span></code></a> or the
direct hash-named constructors such as <a class="reference internal" href="../library/hashlib.html#hashlib.md5" title="hashlib.md5"><code class="xref py py-func docutils literal notranslate"><span class="pre">md5()</span></code></a> and
<a class="reference internal" href="../library/hashlib.html#hashlib.sha256" title="hashlib.sha256"><code class="xref py py-func docutils literal notranslate"><span class="pre">sha256()</span></code></a>, their optional initial data parameter could
also be passed a keyword argument named <code class="docutils literal notranslate"><span class="pre">data=</span></code> or <code class="docutils literal notranslate"><span class="pre">string=</span></code> in
various <code class="xref py py-mod docutils literal notranslate"><span class="pre">hashlib</span></code> implementations.</p>
<p>Support for the <code class="docutils literal notranslate"><span class="pre">string</span></code> keyword argument name is now deprecated
and slated for removal in Python 3.19.</p>
<p>Before Python 3.13, the <code class="docutils literal notranslate"><span class="pre">string</span></code> keyword parameter was not correctly
supported depending on the backend implementation of hash functions.
Prefer passing the initial data as a positional argument for maximum
backwards compatibility.</p>
</li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/http.cookies.html#module-http.cookies" title="http.cookies: Support for HTTP state management (cookies)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">http.cookies</span></code></a>:</p>
<ul class="simple">
<li><p><a class="reference internal" href="../library/http.cookies.html#http.cookies.Morsel.js_output" title="http.cookies.Morsel.js_output"><code class="xref py py-meth docutils literal notranslate"><span class="pre">http.cookies.Morsel.js_output()</span></code></a> is deprecated and will be
removed in Python 3.19.</p></li>
<li><p><a class="reference internal" href="../library/http.cookies.html#http.cookies.BaseCookie.js_output" title="http.cookies.BaseCookie.js_output"><code class="xref py py-meth docutils literal notranslate"><span class="pre">http.cookies.BaseCookie.js_output()</span></code></a> is deprecated and will be
removed in Python 3.19.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/imaplib.html#module-imaplib" title="imaplib: IMAP4 protocol client (requires sockets)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">imaplib</span></code></a>:</p>
<ul>
<li><p>Altering <a class="reference internal" href="../library/imaplib.html#imaplib.IMAP4.file" title="imaplib.IMAP4.file"><code class="xref py py-attr docutils literal notranslate"><span class="pre">IMAP4.file</span></code></a> is now deprecated
and slated for removal in Python 3.19. This property is now unused
and changing its value does not automatically close the current file.</p>
<p>Before Python 3.14, this property was used to implement the corresponding
<code class="docutils literal notranslate"><span class="pre">read()</span></code> and <code class="docutils literal notranslate"><span class="pre">readline()</span></code> methods for <a class="reference internal" href="../library/imaplib.html#imaplib.IMAP4" title="imaplib.IMAP4"><code class="xref py py-class docutils literal notranslate"><span class="pre">IMAP4</span></code></a> but this
is no longer the case since then.</p>
</li>
</ul>
</li>
</ul>
</section>
<section id="pending-removal-in-python-3-20">
<h2>Pending removal in Python 3.20<a class="headerlink" href="#pending-removal-in-python-3-20" title="Link to this heading"></a></h2>
<ul>
<li><p>Calling the <code class="docutils literal notranslate"><span class="pre">__new__()</span></code> method of <a class="reference internal" href="../library/struct.html#struct.Struct" title="struct.Struct"><code class="xref py py-class docutils literal notranslate"><span class="pre">struct.Struct</span></code></a> without the
<em>format</em> argument is deprecated and will be removed in Python 3.20. Calling
<a class="reference internal" href="../reference/datamodel.html#object.__init__" title="object.__init__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__init__()</span></code></a> method on initialized <code class="xref py py-class docutils literal notranslate"><span class="pre">Struct</span></code>
objects is deprecated and will be removed in Python 3.20.</p>
<p>(Contributed by Sergey B Kirpichev and Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/143715">gh-143715</a>.)</p>
</li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">__version__</span></code>, <code class="docutils literal notranslate"><span class="pre">version</span></code> and <code class="docutils literal notranslate"><span class="pre">VERSION</span></code> attributes have been
deprecated in these standard library modules and will be removed in
Python 3.20. Use <a class="reference internal" href="../library/sys.html#sys.version_info" title="sys.version_info"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.version_info</span></code></a> instead.</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></p></li>
<li><p><a class="reference internal" href="../library/csv.html#module-csv" title="csv: Write and read tabular data to and from delimited files."><code class="xref py py-mod docutils literal notranslate"><span class="pre">csv</span></code></a></p></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></li>
<li><p><code class="xref py py-mod docutils literal notranslate"><span class="pre">ctypes.macholib</span></code></p></li>
<li><p><a class="reference internal" href="../library/decimal.html#module-decimal" title="decimal: Implementation of the General Decimal Arithmetic Specification."><code class="xref py py-mod docutils literal notranslate"><span class="pre">decimal</span></code></a> (use <a class="reference internal" href="../library/decimal.html#decimal.SPEC_VERSION" title="decimal.SPEC_VERSION"><code class="xref py py-data docutils literal notranslate"><span class="pre">decimal.SPEC_VERSION</span></code></a> instead)</p></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></li>
<li><p><a class="reference internal" href="../library/imaplib.html#module-imaplib" title="imaplib: IMAP4 protocol client (requires sockets)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">imaplib</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/ipaddress.html#module-ipaddress" title="ipaddress: IPv4/IPv6 manipulation library."><code class="xref py py-mod docutils literal notranslate"><span class="pre">ipaddress</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/json.html#module-json" title="json: Encode and decode the JSON format."><code class="xref py py-mod docutils literal notranslate"><span class="pre">json</span></code></a></p></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> (<code class="docutils literal notranslate"><span class="pre">__date__</span></code> also deprecated)</p></li>
<li><p><a class="reference internal" href="../library/optparse.html#module-optparse" title="optparse: Command-line option parsing library."><code class="xref py py-mod docutils literal notranslate"><span class="pre">optparse</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/pickle.html#module-pickle" title="pickle: Convert Python objects to streams of bytes and back."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pickle</span></code></a></p></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></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></p></li>
<li><p><a class="reference internal" href="../library/socketserver.html#module-socketserver" title="socketserver: A framework for network servers."><code class="xref py py-mod docutils literal notranslate"><span class="pre">socketserver</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/tabnanny.html#module-tabnanny" title="tabnanny: Tool for detecting white space related problems in Python source files in a directory tree."><code class="xref py py-mod docutils literal notranslate"><span class="pre">tabnanny</span></code></a></p></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></li>
<li><p><a class="reference internal" href="../library/tkinter.font.html#module-tkinter.font" title="tkinter.font: Tkinter font-wrapping class"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tkinter.font</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/tkinter.ttk.html#module-tkinter.ttk" title="tkinter.ttk: Tk themed widget set"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tkinter.ttk</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/wsgiref.html#module-wsgiref.simple_server" title="wsgiref.simple_server: A simple WSGI HTTP server."><code class="xref py py-mod docutils literal notranslate"><span class="pre">wsgiref.simple_server</span></code></a></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></p></li>
<li><p><code class="xref py py-mod docutils literal notranslate"><span class="pre">xml.sax.expatreader</span></code></p></li>
<li><p><a class="reference internal" href="../library/xml.sax.handler.html#module-xml.sax.handler" title="xml.sax.handler: Base classes for SAX event handlers."><code class="xref py py-mod docutils literal notranslate"><span class="pre">xml.sax.handler</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/zlib.html#module-zlib" title="zlib: Low-level interface to compression and decompression routines compatible with gzip."><code class="xref py py-mod docutils literal notranslate"><span class="pre">zlib</span></code></a></p></li>
</ul>
<p>(Contributed by Hugo van Kemenade and Stan Ulbrych in <a class="reference external" href="https://github.com/python/cpython/issues/76007">gh-76007</a>.)</p>
</li>
<li><p>Deprecations defined by <span class="target" id="index-5"></span><a class="pep reference external" href="https://peps.python.org/pep-0829/"><strong>PEP 829</strong></a>:</p>
<ul class="simple">
<li><p>Warnings are produced for <code class="docutils literal notranslate"><span class="pre">import</span></code> lines found in <code class="file docutils literal notranslate"><em><span class="pre">name</span></em><span class="pre">.pth</span></code>
files.</p></li>
<li><p><code class="file docutils literal notranslate"><em><span class="pre">name</span></em><span class="pre">.pth</span></code> files are no longer decoded in the locale encoding by
default. They <strong>MUST</strong> be encoded in <code class="docutils literal notranslate"><span class="pre">utf-8-sig</span></code>.</p></li>
</ul>
<p>(Contributed by Barry Warsaw in <a class="reference external" href="https://github.com/python/cpython/issues/148641">gh-148641</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>:</p>
<ul class="simple">
<li><p>Creating instances of abstract AST nodes (such as <a class="reference internal" href="../library/ast.html#ast.AST" title="ast.AST"><code class="xref py py-class docutils literal notranslate"><span class="pre">ast.AST</span></code></a>
or <code class="xref py py-class docutils literal notranslate"><span class="pre">ast.expr</span></code>) is deprecated and will raise an error in Python 3.20.</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>It is deprecated to call <a class="reference internal" href="../builtins/functions.html#isinstance" title="isinstance"><code class="xref py py-func docutils literal notranslate"><span class="pre">isinstance()</span></code></a> and <a class="reference internal" href="../builtins/functions.html#issubclass" title="issubclass"><code class="xref py py-func docutils literal notranslate"><span class="pre">issubclass()</span></code></a> checks on
protocol classes that were not explicitly decorated with <code class="xref py py-func docutils literal notranslate"><span class="pre">runtime_checkable()</span></code>
but that inherit from a runtime-checkable protocol class.
This will raise a <a class="reference internal" href="../builtins/exceptions.html#TypeError" title="TypeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code></a> in Python 3.20.</p>
<p>(Contributed by Bartosz Sławecki in <a class="reference external" href="https://github.com/python/cpython/issues/132604">gh-132604</a>.)</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>:</p>
<ul>
<li><p>Nesting argument groups and nesting mutually exclusive
groups are deprecated.</p></li>
<li><p>Passing the undocumented keyword argument <em>prefix_chars</em> to
<a class="reference internal" href="../library/argparse.html#argparse.ArgumentParser.add_argument_group" title="argparse.ArgumentParser.add_argument_group"><code class="xref py py-meth docutils literal notranslate"><span class="pre">add_argument_group()</span></code></a> is now
deprecated.</p></li>
<li><p>The <a class="reference internal" href="../library/argparse.html#argparse.FileType" title="argparse.FileType"><code class="xref py py-class docutils literal notranslate"><span class="pre">argparse.FileType</span></code></a> type converter is deprecated.</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>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="../builtins/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="../builtins/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
<code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code>.</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="../builtins/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
<code class="xref py py-class docutils literal notranslate"><span class="pre">complex</span></code>.</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="../builtins/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="../library/codecs.html#module-codecs" title="codecs: Encode and decode data and streams."><code class="xref py py-mod docutils literal notranslate"><span class="pre">codecs</span></code></a>: use <a class="reference internal" href="../builtins/functions.html#open" title="open"><code class="xref py py-func docutils literal notranslate"><span class="pre">open()</span></code></a> instead of <a class="reference internal" href="../library/codecs.html#codecs.open" title="codecs.open"><code class="xref py py-func docutils literal notranslate"><span class="pre">codecs.open()</span></code></a>. (<a class="reference external" href="https://github.com/python/cpython/issues/133038">gh-133038</a>)</p></li>
<li><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">codeobject.co_lnotab</span></code>: 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><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 a multi-threaded process.</p></li>
<li><p><a class="reference internal" href="../library/os.path.html#module-os.path" title="os.path: Operations on pathnames."><code class="xref py py-mod docutils literal notranslate"><span class="pre">os.path</span></code></a>: <a class="reference internal" href="../library/os.path.html#os.path.commonprefix" title="os.path.commonprefix"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.path.commonprefix()</span></code></a> is deprecated, use
<a class="reference internal" href="../library/os.path.html#os.path.commonpath" title="os.path.commonpath"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.path.commonpath()</span></code></a> for path prefixes. The <code class="xref py py-func docutils literal notranslate"><span class="pre">os.path.commonprefix()</span></code>
function is being deprecated due to having a misleading name and module.
The function is not safe to use for path prefixes despite being included in a
module about path manipulation, meaning it is easy to accidentally
introduce path traversal vulnerabilities into Python programs by using this
function.</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><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/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>The internal class <code class="docutils literal notranslate"><span class="pre">typing._UnionGenericAlias</span></code> is no longer used to implement
<a class="reference internal" href="../library/typing.html#typing.Union" title="typing.Union"><code class="xref py py-class docutils literal notranslate"><span class="pre">typing.Union</span></code></a>. To preserve compatibility with users using this private
class, a compatibility shim will be provided until at least Python 3.17. (Contributed by
Jelle Zijlstra in <a class="reference external" href="https://github.com/python/cpython/issues/105499">gh-105499</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/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/sys.html#sys._clear_type_cache" title="sys._clear_type_cache"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys._clear_type_cache()</span></code></a> is deprecated:
use <a class="reference internal" href="../library/sys.html#sys._clear_internal_caches" title="sys._clear_internal_caches"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys._clear_internal_caches()</span></code></a> instead.</p></li>
</ul>
</section>
<section id="soft-deprecations">
<h2>Soft deprecations<a class="headerlink" href="#soft-deprecations" title="Link to this heading"></a></h2>
<p>There are no plans to remove <a class="reference internal" href="../glossary.html#term-soft-deprecated"><span class="xref std std-term">soft deprecated</span></a> APIs.</p>
<ul>
<li><p><a class="reference internal" href="../library/re.html#re.match" title="re.match"><code class="xref py py-func docutils literal notranslate"><span class="pre">re.match()</span></code></a> and <a class="reference internal" href="../library/re.html#re.Pattern.match" title="re.Pattern.match"><code class="xref py py-meth docutils literal notranslate"><span class="pre">re.Pattern.match()</span></code></a> are now
<a class="reference internal" href="../glossary.html#term-soft-deprecated"><span class="xref std std-term">soft deprecated</span></a> in favor of the new <a class="reference internal" href="../library/re.html#re.prefixmatch" title="re.prefixmatch"><code class="xref py py-func docutils literal notranslate"><span class="pre">re.prefixmatch()</span></code></a> and
<a class="reference internal" href="../library/re.html#re.Pattern.prefixmatch" title="re.Pattern.prefixmatch"><code class="xref py py-meth docutils literal notranslate"><span class="pre">re.Pattern.prefixmatch()</span></code></a> APIs, which have been added as alternate,
more explicit names. These are intended to be used to alleviate confusion
around what <em>match</em> means by following the Zen of Python’s <em>“Explicit is
better than implicit”</em> mantra. Most other language regular expression
libraries use an API named <em>match</em> to mean what Python has always called
<em>search</em>.</p>
<p>We <strong>do not</strong> plan to remove the older <code class="xref py py-func docutils literal notranslate"><span class="pre">match()</span></code> name, as it has been
used in code for over 30 years. Code supporting older versions of Python
should continue to use <code class="xref py py-func docutils literal notranslate"><span class="pre">match()</span></code>, while new code should prefer
<code class="xref py py-func docutils literal notranslate"><span class="pre">prefixmatch()</span></code>. See <a class="reference internal" href="../library/re.html#prefixmatch-vs-match"><span class="std std-ref">prefixmatch() vs. match()</span></a>.</p>
<p>(Contributed by Gregory P. Smith in <a class="reference external" href="https://github.com/python/cpython/issues/86519">gh-86519</a> and
Hugo van Kemenade in <a class="reference external" href="https://github.com/python/cpython/issues/148100">gh-148100</a>.)</p>
</li>
<li><p>Using <code class="docutils literal notranslate"><span class="pre">'F'</span></code> and <code class="docutils literal notranslate"><span class="pre">'D'</span></code> format type codes of the <a class="reference internal" href="../library/struct.html#module-struct" title="struct: Interpret bytes as packed binary data."><code class="xref py py-mod docutils literal notranslate"><span class="pre">struct</span></code></a> module
now are <a class="reference internal" href="../glossary.html#term-soft-deprecated"><span class="xref std std-term">soft deprecated</span></a> in favor of two-letter forms <code class="docutils literal notranslate"><span class="pre">'Zf'</span></code>
and <code class="docutils literal notranslate"><span class="pre">'Zd'</span></code>.
(Contributed by Sergey B Kirpichev in <a class="reference external" href="https://github.com/python/cpython/issues/121249">gh-121249</a>.)</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="pending-removal-in-python-3-15">
<h3>Pending removal in Python 3.15<a class="headerlink" href="#pending-removal-in-python-3-15" title="Link to this heading"></a></h3>
<ul>
<li><p>The <code class="xref c c-func docutils literal notranslate"><span class="pre">PyImport_ImportModuleNoBlock()</span></code>:
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><code class="xref c c-func docutils literal notranslate"><span class="pre">PyWeakref_GetObject()</span></code> and <code class="xref c c-func docutils literal notranslate"><span class="pre">PyWeakref_GET_OBJECT()</span></code>:
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. The <a class="reference external" href="https://github.com/python/pythoncapi-compat/">pythoncapi-compat project</a> can be used to get
<code class="xref c c-func docutils literal notranslate"><span class="pre">PyWeakref_GetRef()</span></code> on Python 3.12 and older.</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; Note that some codecs (for example, “base64”)
may return a type other than <a class="reference internal" href="../builtins/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, such as <a class="reference internal" href="../builtins/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a>.</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; Note that some codecs (for example, “base64”)
may return a type other than <a class="reference internal" href="../builtins/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a>, such as <a class="reference internal" href="../builtins/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>.</p></li>
<li><p>Python initialization functions, deprecated in Python 3.13:</p>
<ul class="simple">
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetPath()</span></code>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;module_search_paths&quot;)</span></code></a>
(<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><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetPrefix()</span></code>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;base_prefix&quot;)</span></code></a>
(<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>) instead. Use <code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;prefix&quot;)</span></code> (<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>) if <a class="reference internal" href="../library/venv.html#venv-def"><span class="std std-ref">virtual environments</span></a> need to be handled.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetExecPrefix()</span></code>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;base_exec_prefix&quot;)</span></code></a>
(<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>) instead. Use
<code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;exec_prefix&quot;)</span></code>
(<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>) if <a class="reference internal" href="../library/venv.html#venv-def"><span class="std std-ref">virtual environments</span></a> need to
be handled.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetProgramFullPath()</span></code>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;executable&quot;)</span></code></a>
(<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><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetProgramName()</span></code>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;executable&quot;)</span></code></a>
(<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><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetPythonHome()</span></code>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;home&quot;)</span></code></a> or the
<span class="target" id="index-6"></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>
<p>The <a class="reference external" href="https://github.com/python/pythoncapi-compat/">pythoncapi-compat project</a> can be used to get
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get()</span></code></a> on Python 3.13 and older.</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>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">PySys_ResetWarnOptions()</span></code>:
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>
</ul>
<p>The <a class="reference internal" href="../c-api/interp-lifecycle.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/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;parser_debug&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;verbose&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;quiet&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;interactive&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;inspect&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;optimization_level&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;site_import&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;bytes_warning&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;pathconfig_warnings&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;use_environment&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;write_bytecode&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;user_site_directory&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;buffered_stdio&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;hash_seed&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;isolated&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;legacy_windows_fs_encoding&quot;)</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/interp-lifecycle.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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;legacy_windows_stdio&quot;)</span></code></a> instead.</p></li>
<li><p><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_FileSystemDefaultEncoding</span></code>, <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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;filesystem_encoding&quot;)</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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;filesystem_errors&quot;)</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> or
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get(&quot;utf8_mode&quot;)</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/interp-lifecycle.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> to set these options. Or <a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Get" title="PyConfig_Get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Get()</span></code></a> can be
used to get these options at runtime.</p>
</li>
</ul>
</section>
<section id="id1">
<h3>Pending removal in Python 3.16<a class="headerlink" href="#id1" title="Link to this heading"></a></h3>
<ul class="simple">
<li><p>The bundled copy of <code class="docutils literal notranslate"><span class="pre">libmpdec</span></code>.</p></li>
</ul>
</section>
<section id="id2">
<h3>Pending removal in Python 3.18<a class="headerlink" href="#id2" title="Link to this heading"></a></h3>
<ul>
<li><p>The following private functions are deprecated
and planned for removal in Python 3.18:</p>
<ul class="simple">
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyBytes_Join()</span></code>: use <a class="reference internal" href="../c-api/bytes.html#c.PyBytes_Join" title="PyBytes_Join"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyBytes_Join()</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyDict_GetItemStringWithError()</span></code>: use <a class="reference internal" href="../c-api/dict.html#c.PyDict_GetItemStringRef" title="PyDict_GetItemStringRef"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyDict_GetItemStringRef()</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyDict_Pop()</span></code>: use <a class="reference internal" href="../c-api/dict.html#c.PyDict_Pop" title="PyDict_Pop"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyDict_Pop()</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyLong_Sign()</span></code>: use <a class="reference internal" href="../c-api/long.html#c.PyLong_GetSign" title="PyLong_GetSign"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_GetSign()</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyLong_FromDigits()</span></code> and <code class="xref c c-func docutils literal notranslate"><span class="pre">_PyLong_New()</span></code>:
use <a class="reference internal" href="../c-api/long.html#c.PyLongWriter_Create" title="PyLongWriter_Create"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLongWriter_Create()</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyThreadState_UncheckedGet()</span></code>: use <a class="reference internal" href="../c-api/threads.html#c.PyThreadState_GetUnchecked" title="PyThreadState_GetUnchecked"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThreadState_GetUnchecked()</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyUnicode_AsString()</span></code>: use <a class="reference internal" href="../c-api/unicode.html#c.PyUnicode_AsUTF8" title="PyUnicode_AsUTF8"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicode_AsUTF8()</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyUnicodeWriter_Init()</span></code>:
replace <code class="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_Init(&amp;writer)</span></code> with
<a class="reference internal" href="../c-api/unicode.html#c.PyUnicodeWriter_Create" title="PyUnicodeWriter_Create"><code class="xref c c-func docutils literal notranslate"><span class="pre">writer</span> <span class="pre">=</span> <span class="pre">PyUnicodeWriter_Create(0)</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyUnicodeWriter_Finish()</span></code>:
replace <code class="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_Finish(&amp;writer)</span></code> with
<a class="reference internal" href="../c-api/unicode.html#c.PyUnicodeWriter_Finish" title="PyUnicodeWriter_Finish"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicodeWriter_Finish(writer)</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyUnicodeWriter_Dealloc()</span></code>:
replace <code class="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_Dealloc(&amp;writer)</span></code> with
<a class="reference internal" href="../c-api/unicode.html#c.PyUnicodeWriter_Discard" title="PyUnicodeWriter_Discard"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicodeWriter_Discard(writer)</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyUnicodeWriter_WriteChar()</span></code>:
replace <code class="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_WriteChar(&amp;writer,</span> <span class="pre">ch)</span></code> with
<a class="reference internal" href="../c-api/unicode.html#c.PyUnicodeWriter_WriteChar" title="PyUnicodeWriter_WriteChar"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicodeWriter_WriteChar(writer,</span> <span class="pre">ch)</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyUnicodeWriter_WriteStr()</span></code>:
replace <code class="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_WriteStr(&amp;writer,</span> <span class="pre">str)</span></code> with
<a class="reference internal" href="../c-api/unicode.html#c.PyUnicodeWriter_WriteStr" title="PyUnicodeWriter_WriteStr"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicodeWriter_WriteStr(writer,</span> <span class="pre">str)</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyUnicodeWriter_WriteSubstring()</span></code>:
replace <code class="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_WriteSubstring(&amp;writer,</span> <span class="pre">str,</span> <span class="pre">start,</span> <span class="pre">end)</span></code> with
<a class="reference internal" href="../c-api/unicode.html#c.PyUnicodeWriter_WriteSubstring" title="PyUnicodeWriter_WriteSubstring"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicodeWriter_WriteSubstring(writer,</span> <span class="pre">str,</span> <span class="pre">start,</span> <span class="pre">end)</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyUnicodeWriter_WriteASCIIString()</span></code>:
replace <code class="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_WriteASCIIString(&amp;writer,</span> <span class="pre">str)</span></code> with
<a class="reference internal" href="../c-api/unicode.html#c.PyUnicodeWriter_WriteASCII" title="PyUnicodeWriter_WriteASCII"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicodeWriter_WriteASCII(writer,</span> <span class="pre">str)</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyUnicodeWriter_WriteLatin1String()</span></code>:
replace <code class="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_WriteLatin1String(&amp;writer,</span> <span class="pre">str)</span></code> with
<a class="reference internal" href="../c-api/unicode.html#c.PyUnicodeWriter_WriteUTF8" title="PyUnicodeWriter_WriteUTF8"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicodeWriter_WriteUTF8(writer,</span> <span class="pre">str)</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyUnicodeWriter_Prepare()</span></code>: (no replacement).</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyUnicodeWriter_PrepareKind()</span></code>: (no replacement).</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_Py_HashPointer()</span></code>: use <a class="reference internal" href="../c-api/hash.html#c.Py_HashPointer" title="Py_HashPointer"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_HashPointer()</span></code></a>.</p></li>
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_Py_fopen_obj()</span></code>: use <a class="reference internal" href="../c-api/sys.html#c.Py_fopen" title="Py_fopen"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_fopen()</span></code></a>.</p></li>
</ul>
<p>The <a class="reference external" href="https://github.com/python/pythoncapi-compat/">pythoncapi-compat project</a> can be used to get
these new public functions on Python 3.13 and older.
(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/128863">gh-128863</a>.)</p>
</li>
</ul>
</section>
<section id="id3">
<h3>Pending removal in Python 3.19<a class="headerlink" href="#id3" title="Link to this heading"></a></h3>
<ul class="simple">
<li><p><span class="target" id="index-7"></span><a class="pep reference external" href="https://peps.python.org/pep-0456/"><strong>PEP 456</strong></a> embedders support for the string hashing scheme definition.</p></li>
</ul>
</section>
<section id="id4">
<h3>Pending removal in Python 3.20<a class="headerlink" href="#id4" title="Link to this heading"></a></h3>
<ul class="simple">
<li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">_PyObject_CallMethodId()</span></code>, <code class="xref c c-func docutils literal notranslate"><span class="pre">_PyObject_GetAttrId()</span></code> and
<code class="xref c c-func docutils literal notranslate"><span class="pre">_PyUnicode_FromId()</span></code> are deprecated since 3.15 and will be removed in
3.20. Instead, use <a class="reference internal" href="../c-api/unicode.html#c.PyUnicode_InternFromString" title="PyUnicode_InternFromString"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicode_InternFromString()</span></code></a> and cache the result in
the module state, then call <a class="reference internal" href="../c-api/call.html#c.PyObject_CallMethod" title="PyObject_CallMethod"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyObject_CallMethod()</span></code></a> or
<a class="reference internal" href="../c-api/object.html#c.PyObject_GetAttr" title="PyObject_GetAttr"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyObject_GetAttr()</span></code></a>.
(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/141049">gh-141049</a>.)</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">cval</span></code> field in <a class="reference internal" href="../c-api/complex.html#c.PyComplexObject" title="PyComplexObject"><code class="xref c c-type docutils literal notranslate"><span class="pre">PyComplexObject</span></code></a> (<a class="reference external" href="https://github.com/python/cpython/issues/128813">gh-128813</a>).
Use <a class="reference internal" href="../c-api/complex.html#c.PyComplex_AsCComplex" title="PyComplex_AsCComplex"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyComplex_AsCComplex()</span></code></a> and <a class="reference internal" href="../c-api/complex.html#c.PyComplex_FromCComplex" title="PyComplex_FromCComplex"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyComplex_FromCComplex()</span></code></a>
to convert a Python complex number to/from the C <a class="reference internal" href="../c-api/complex.html#c.Py_complex" title="Py_complex"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_complex</span></code></a>
representation.</p></li>
<li><p>Macros <code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_MATH_PIl</span></code> and <code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_MATH_El</span></code>.</p></li>
</ul>
</section>
<section id="id5">
<h3>Pending removal in future versions<a class="headerlink" href="#id5" 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><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>Thread Local Storage (TLS) API:</p>
<ul>
<li><p><a class="reference internal" href="../c-api/tls.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/tls.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/tls.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/tls.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/tls.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/tls.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/tls.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/tls.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/tls.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/tls.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/tls.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-16">Pending removal in Python 3.16</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-17">Pending removal in Python 3.17</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-18">Pending removal in Python 3.18</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-19">Pending removal in Python 3.19</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-20">Pending removal in Python 3.20</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="#soft-deprecations">Soft deprecations</a></li>
<li><a class="reference internal" href="#c-api-deprecations">C API deprecations</a><ul>
<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="#id1">Pending removal in Python 3.16</a></li>
<li><a class="reference internal" href="#id2">Pending removal in Python 3.18</a></li>
<li><a class="reference internal" href="#id3">Pending removal in Python 3.19</a></li>
<li><a class="reference internal" href="#id4">Pending removal in Python 3.20</a></li>
<li><a class="reference internal" href="#id5">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>
<script>
document.addEventListener('DOMContentLoaded', () => {
const title = document.querySelector('meta[property="og:title"]').content;
const elements = document.querySelectorAll('.improvepage');
const pageurl = window.location.href.split('?')[0];
elements.forEach(element => {
const url = new URL(element.href.split('?')[0].replace("-nojs", ""));
url.searchParams.set('pagetitle', title);
url.searchParams.set('pageurl', pageurl);
url.searchParams.set('pagesource', "deprecations/index.rst");
element.href = url.toString();
});
});
</script>
<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 class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>
<li>
<a href="https://github.com/python/cpython/blob/3.15/Doc/deprecations/index.rst?plain=1"
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 class="root-icon"><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> &#187;</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.15.0 Documentation</a> &#187;
</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">
&copy; <a href="../copyright.html">Copyright</a> 2001 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 Oct 09, 2026 (11:35 UTC).
<a href="/bugs.html">Found a bug</a>?
<br>
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
</div>
</body>
</html>