Mini Kabibi Habibi

Current Path : C:/Users/ITO/AppData/Local/Programs/Python/Python314/Doc/html/deprecations/
Upload File :
Current File : C:/Users/ITO/AppData/Local/Programs/Python/Python314/Doc/html/deprecations/index.html

<!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.15: The import system:- Setting__cached__ on a module while failing to set__spec__.cached is deprecated. In Python 3.15,__cached__ will cease to be set or take into cons..." />
<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.15: The import system:- Setting__cached__ on a module while failing to set__spec__.cached is deprecated. In Python 3.15,__cached__ will cease to be set or take into cons..." />
<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.14.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=8cd84f99" />
    <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=5349f25f" />
    
    <script src="../_static/documentation_options.js?v=e4f4b189"></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.14.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-15">Pending removal in Python 3.15</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-16">Pending removal in Python 3.16</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-17">Pending removal in Python 3.17</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-future-versions">Pending removal in future versions</a></li>
<li><a class="reference internal" href="#c-api-deprecations">C API deprecations</a><ul>
<li><a class="reference internal" href="#id1">Pending removal in Python 3.15</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="#id2">Pending removal in future versions</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  </div>
  <div>
    <h4>Previous topic</h4>
    <p class="topless"><a href="../faq/installed.html"
                          title="previous chapter">“Why is Python Installed on my Computer?” FAQ</a></p>
  </div>
  <div>
    <h4>Next topic</h4>
    <p class="topless"><a href="../glossary.html"
                          title="next chapter">Glossary</a></p>
  </div>
  <div role="note" aria-label="source link">
    <h3>This page</h3>
    <ul class="this-page-menu">
      <li><a href="../bugs.html">Report a bug</a></li>
      <li>
        <a href="https://github.com/python/cpython/blob/main/Doc/deprecations/index.rst?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><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.14.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-15">
<h2>Pending removal in Python 3.15<a class="headerlink" href="#pending-removal-in-python-3-15" title="Link to this heading">¶</a></h2>
<ul class="simple">
<li><p>The import system:</p>
<ul>
<li><p>Setting <a class="reference internal" href="../reference/datamodel.html#module.__cached__" title="module.__cached__"><code class="xref py py-attr docutils literal notranslate"><span class="pre">__cached__</span></code></a> on a module while
failing to set <a class="reference internal" href="../library/importlib.html#importlib.machinery.ModuleSpec.cached" title="importlib.machinery.ModuleSpec.cached"><code class="xref py py-attr docutils literal notranslate"><span class="pre">__spec__.cached</span></code></a>
is deprecated. In Python 3.15, <code class="xref py py-attr docutils literal notranslate"><span class="pre">__cached__</span></code> will cease to be set or
take into consideration by the import system or standard library. (<a class="reference external" href="https://github.com/python/cpython/issues/97879">gh-97879</a>)</p></li>
<li><p>Setting <a class="reference internal" href="../reference/datamodel.html#module.__package__" title="module.__package__"><code class="xref py py-attr docutils literal notranslate"><span class="pre">__package__</span></code></a> on a module while
failing to set <a class="reference internal" href="../library/importlib.html#importlib.machinery.ModuleSpec.parent" title="importlib.machinery.ModuleSpec.parent"><code class="xref py py-attr docutils literal notranslate"><span class="pre">__spec__.parent</span></code></a>
is deprecated. In Python 3.15, <code class="xref py py-attr docutils literal notranslate"><span class="pre">__package__</span></code> will cease to be set or
take into consideration by the import system or standard library. (<a class="reference external" href="https://github.com/python/cpython/issues/97879">gh-97879</a>)</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/ctypes.html#module-ctypes" title="ctypes: A foreign function library for Python."><code class="xref py py-mod docutils literal notranslate"><span class="pre">ctypes</span></code></a>:</p>
<ul>
<li><p>The undocumented <code class="xref py py-func docutils literal notranslate"><span class="pre">ctypes.SetPointerType()</span></code> function
has been deprecated since Python 3.13.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/http.server.html#module-http.server" title="http.server: HTTP server and request handlers."><code class="xref py py-mod docutils literal notranslate"><span class="pre">http.server</span></code></a>:</p>
<ul>
<li><p>The obsolete and rarely used <a class="reference internal" href="../library/http.server.html#http.server.CGIHTTPRequestHandler" title="http.server.CGIHTTPRequestHandler"><code class="xref py py-class docutils literal notranslate"><span class="pre">CGIHTTPRequestHandler</span></code></a>
has been deprecated since Python 3.13.
No direct replacement exists.
<em>Anything</em> is better than CGI to interface
a web server with a request handler.</p></li>
<li><p>The <code class="xref std std-option docutils literal notranslate"><span class="pre">--cgi</span></code> flag to the <strong class="program">python -m http.server</strong>
command-line interface has been deprecated since Python 3.13.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/importlib.html#module-importlib" title="importlib: The implementation of the import machinery."><code class="xref py py-mod docutils literal notranslate"><span class="pre">importlib</span></code></a>:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">load_module()</span></code> method: use <code class="docutils literal notranslate"><span class="pre">exec_module()</span></code> instead.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/locale.html#module-locale" title="locale: Internationalization services."><code class="xref py py-class docutils literal notranslate"><span class="pre">locale</span></code></a>:</p>
<ul>
<li><p>The <a class="reference internal" href="../library/locale.html#locale.getdefaultlocale" title="locale.getdefaultlocale"><code class="xref py py-func docutils literal notranslate"><span class="pre">getdefaultlocale()</span></code></a> function
has been deprecated since Python 3.11.
Its removal was originally planned for Python 3.13 (<a class="reference external" href="https://github.com/python/cpython/issues/90817">gh-90817</a>),
but has been postponed to Python 3.15.
Use <a class="reference internal" href="../library/locale.html#locale.getlocale" title="locale.getlocale"><code class="xref py py-func docutils literal notranslate"><span class="pre">getlocale()</span></code></a>, <a class="reference internal" href="../library/locale.html#locale.setlocale" title="locale.setlocale"><code class="xref py py-func docutils literal notranslate"><span class="pre">setlocale()</span></code></a>,
and <a class="reference internal" href="../library/locale.html#locale.getencoding" title="locale.getencoding"><code class="xref py py-func docutils literal notranslate"><span class="pre">getencoding()</span></code></a> instead.
(Contributed by Hugo van Kemenade in <a class="reference external" href="https://github.com/python/cpython/issues/111187">gh-111187</a>.)</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/pathlib.html#module-pathlib" title="pathlib: Object-oriented filesystem paths"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pathlib</span></code></a>:</p>
<ul>
<li><p><a class="reference internal" href="../library/pathlib.html#pathlib.PurePath.is_reserved" title="pathlib.PurePath.is_reserved"><code class="xref py py-meth docutils literal notranslate"><span class="pre">PurePath.is_reserved()</span></code></a>
has been deprecated since Python 3.13.
Use <a class="reference internal" href="../library/os.path.html#os.path.isreserved" title="os.path.isreserved"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.path.isreserved()</span></code></a> to detect reserved paths on Windows.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/platform.html#module-platform" title="platform: Retrieves as much platform identifying data as possible."><code class="xref py py-mod docutils literal notranslate"><span class="pre">platform</span></code></a>:</p>
<ul>
<li><p><a class="reference internal" href="../library/platform.html#platform.java_ver" title="platform.java_ver"><code class="xref py py-func docutils literal notranslate"><span class="pre">java_ver()</span></code></a> has been deprecated since Python 3.13.
This function is only useful for Jython support, has a confusing API,
and is largely untested.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/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>
<li><p>The <em>check_home</em> argument of <a class="reference internal" href="../library/sysconfig.html#sysconfig.is_python_build" title="sysconfig.is_python_build"><code class="xref py py-func docutils literal notranslate"><span class="pre">sysconfig.is_python_build()</span></code></a> has been
deprecated since Python 3.12.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/threading.html#module-threading" title="threading: Thread-based parallelism."><code class="xref py py-mod docutils literal notranslate"><span class="pre">threading</span></code></a>:</p>
<ul>
<li><p><a class="reference internal" href="../library/threading.html#threading.RLock" title="threading.RLock"><code class="xref py py-func docutils literal notranslate"><span class="pre">RLock()</span></code></a> will take no arguments in Python 3.15.
Passing any arguments has been deprecated since Python 3.14,
as the  Python version does not permit any arguments,
but the C version allows any number of positional or keyword arguments,
ignoring every argument.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/types.html#module-types" title="types: Names for built-in types."><code class="xref py py-mod docutils literal notranslate"><span class="pre">types</span></code></a>:</p>
<ul>
<li><p><a class="reference internal" href="../library/types.html#types.CodeType" title="types.CodeType"><code class="xref py py-class docutils literal notranslate"><span class="pre">types.CodeType</span></code></a>: Accessing <a class="reference internal" href="../reference/datamodel.html#codeobject.co_lnotab" title="codeobject.co_lnotab"><code class="xref py py-attr docutils literal notranslate"><span class="pre">co_lnotab</span></code></a> was
deprecated in <span class="target" id="index-0"></span><a class="pep reference external" href="https://peps.python.org/pep-0626/"><strong>PEP 626</strong></a>
since 3.10 and was planned to be removed in 3.12,
but it only got a proper <a class="reference internal" href="../library/exceptions.html#DeprecationWarning" title="DeprecationWarning"><code class="xref py py-exc docutils literal notranslate"><span class="pre">DeprecationWarning</span></code></a> in 3.12.
May be removed in 3.15.
(Contributed by Nikita Sobolev in <a class="reference external" href="https://github.com/python/cpython/issues/101866">gh-101866</a>.)</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/typing.html#module-typing" title="typing: Support for type hints (see :pep:`484`)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">typing</span></code></a>:</p>
<ul>
<li><p>The undocumented keyword argument syntax for creating
<a class="reference internal" href="../library/typing.html#typing.NamedTuple" title="typing.NamedTuple"><code class="xref py py-class docutils literal notranslate"><span class="pre">NamedTuple</span></code></a> classes
(for example, <code class="docutils literal notranslate"><span class="pre">Point</span> <span class="pre">=</span> <span class="pre">NamedTuple(&quot;Point&quot;,</span> <span class="pre">x=int,</span> <span class="pre">y=int)</span></code>)
has been deprecated since Python 3.13.
Use the class-based syntax or the functional syntax instead.</p></li>
<li><p>When using the functional syntax of <a class="reference internal" href="../library/typing.html#typing.TypedDict" title="typing.TypedDict"><code class="xref py py-class docutils literal notranslate"><span class="pre">TypedDict</span></code></a>s, failing
to pass a value to the <em>fields</em> parameter (<code class="docutils literal notranslate"><span class="pre">TD</span> <span class="pre">=</span> <span class="pre">TypedDict(&quot;TD&quot;)</span></code>) or
passing <code class="docutils literal notranslate"><span class="pre">None</span></code> (<code class="docutils literal notranslate"><span class="pre">TD</span> <span class="pre">=</span> <span class="pre">TypedDict(&quot;TD&quot;,</span> <span class="pre">None)</span></code>) has been deprecated
since Python 3.13.
Use <code class="docutils literal notranslate"><span class="pre">class</span> <span class="pre">TD(TypedDict):</span> <span class="pre">pass</span></code> or <code class="docutils literal notranslate"><span class="pre">TD</span> <span class="pre">=</span> <span class="pre">TypedDict(&quot;TD&quot;,</span> <span class="pre">{})</span></code>
to create a TypedDict with zero field.</p></li>
<li><p>The <a class="reference internal" href="../library/typing.html#typing.no_type_check_decorator" title="typing.no_type_check_decorator"><code class="xref py py-func docutils literal notranslate"><span class="pre">typing.no_type_check_decorator()</span></code></a> decorator function
has been deprecated since Python 3.13.
After eight years in the <a class="reference internal" href="../library/typing.html#module-typing" title="typing: Support for type hints (see :pep:`484`)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">typing</span></code></a> module,
it has yet to be supported by any major type checker.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/wave.html#module-wave" title="wave: Provide an interface to the WAV sound format."><code class="xref py py-mod docutils literal notranslate"><span class="pre">wave</span></code></a>:</p>
<ul>
<li><p>The <a class="reference internal" href="../library/wave.html#wave.Wave_read.getmark" title="wave.Wave_read.getmark"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getmark()</span></code></a>, <code class="xref py py-meth docutils literal notranslate"><span class="pre">setmark()</span></code>,
and <a class="reference internal" href="../library/wave.html#wave.Wave_read.getmarkers" title="wave.Wave_read.getmarkers"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getmarkers()</span></code></a> methods of
the <a class="reference internal" href="../library/wave.html#wave.Wave_read" title="wave.Wave_read"><code class="xref py py-class docutils literal notranslate"><span class="pre">Wave_read</span></code></a> and <a class="reference internal" href="../library/wave.html#wave.Wave_write" title="wave.Wave_write"><code class="xref py py-class docutils literal notranslate"><span class="pre">Wave_write</span></code></a> classes
have been deprecated since Python 3.13.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/zipimport.html#module-zipimport" title="zipimport: Support for importing Python modules from ZIP archives."><code class="xref py py-mod docutils literal notranslate"><span class="pre">zipimport</span></code></a>:</p>
<ul>
<li><p><a class="reference internal" href="../library/zipimport.html#zipimport.zipimporter.load_module" title="zipimport.zipimporter.load_module"><code class="xref py py-meth docutils literal notranslate"><span class="pre">load_module()</span></code></a> has been deprecated since
Python 3.10. Use <a class="reference internal" href="../library/zipimport.html#zipimport.zipimporter.exec_module" title="zipimport.zipimporter.exec_module"><code class="xref py py-meth docutils literal notranslate"><span class="pre">exec_module()</span></code></a> instead.
(Contributed by Jiahao Li in <a class="reference external" href="https://github.com/python/cpython/issues/125746">gh-125746</a>.)</p></li>
</ul>
</li>
</ul>
</section>
<section id="pending-removal-in-python-3-16">
<h2>Pending removal in Python 3.16<a class="headerlink" href="#pending-removal-in-python-3-16" title="Link to this heading">¶</a></h2>
<ul>
<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>
<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>
<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="../library/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="../library/exceptions.html#RuntimeError" title="RuntimeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">RuntimeError</span></code></a>.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/symtable.html#module-symtable" title="symtable: Interface to the compiler's internal symbol tables."><code class="xref py py-mod docutils literal notranslate"><span class="pre">symtable</span></code></a>:</p>
<ul 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-1"></span><a class="reference internal" href="../using/cmdline.html#envvar-PYTHONLEGACYWINDOWSFSENCODING"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONLEGACYWINDOWSFSENCODING</span></code></a> environment variable instead.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/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/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="../library/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="../library/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="../library/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-2"></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/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="../library/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="../library/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="../library/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>
</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 class="simple">
<li><p><a class="reference internal" href="../library/ctypes.html#module-ctypes" title="ctypes: A foreign function library for Python."><code class="xref py py-mod docutils literal notranslate"><span class="pre">ctypes</span></code></a>:</p>
<ul>
<li><p>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>
</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="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>.</p></li>
<li><p>Support for <code class="docutils literal notranslate"><span class="pre">__float__()</span></code> method returning a strict subclass of
<a class="reference internal" href="../library/functions.html#float" title="float"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>: these methods will be required to return an instance of
<a class="reference internal" href="../library/functions.html#float" title="float"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>.</p></li>
<li><p>Support for <code class="docutils literal notranslate"><span class="pre">__complex__()</span></code> method returning a strict subclass of
<a class="reference internal" href="../library/functions.html#complex" title="complex"><code class="xref py py-class docutils literal notranslate"><span class="pre">complex</span></code></a>: these methods will be required to return an instance of
<a class="reference internal" href="../library/functions.html#complex" title="complex"><code class="xref py py-class docutils literal notranslate"><span class="pre">complex</span></code></a>.</p></li>
<li><p>Delegation of <code class="docutils literal notranslate"><span class="pre">int()</span></code> to <code class="docutils literal notranslate"><span class="pre">__trunc__()</span></code> method.</p></li>
<li><p>Passing a complex number as the <em>real</em> or <em>imag</em> argument in the
<a class="reference internal" href="../library/functions.html#complex" title="complex"><code class="xref py py-func docutils literal notranslate"><span class="pre">complex()</span></code></a> constructor is now deprecated; it should only be passed
as a single positional argument.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/109218">gh-109218</a>.)</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/calendar.html#module-calendar" title="calendar: Functions for working with calendars, including some emulation of the Unix cal program."><code class="xref py py-mod docutils literal notranslate"><span class="pre">calendar</span></code></a>: <code class="docutils literal notranslate"><span class="pre">calendar.January</span></code> and <code class="docutils literal notranslate"><span class="pre">calendar.February</span></code> constants are
deprecated and replaced by <a class="reference internal" href="../library/calendar.html#calendar.JANUARY" title="calendar.JANUARY"><code class="xref py py-data docutils literal notranslate"><span class="pre">calendar.JANUARY</span></code></a> and
<a class="reference internal" href="../library/calendar.html#calendar.FEBRUARY" title="calendar.FEBRUARY"><code class="xref py py-data docutils literal notranslate"><span class="pre">calendar.FEBRUARY</span></code></a>.
(Contributed by Prince Roshan in <a class="reference external" href="https://github.com/python/cpython/issues/103636">gh-103636</a>.)</p></li>
<li><p><a class="reference internal" href="../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="../library/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><a class="reference internal" href="../reference/datamodel.html#codeobject.co_lnotab" title="codeobject.co_lnotab"><code class="xref py py-attr docutils literal notranslate"><span class="pre">codeobject.co_lnotab</span></code></a>: use the <a class="reference internal" href="../reference/datamodel.html#codeobject.co_lines" title="codeobject.co_lines"><code class="xref py py-meth docutils literal notranslate"><span class="pre">codeobject.co_lines()</span></code></a> method
instead.</p></li>
<li><p><a class="reference internal" href="../library/datetime.html#module-datetime" title="datetime: Basic date and time types."><code class="xref py py-mod docutils literal notranslate"><span class="pre">datetime</span></code></a>:</p>
<ul>
<li><p><a class="reference internal" href="../library/datetime.html#datetime.datetime.utcnow" title="datetime.datetime.utcnow"><code class="xref py py-meth docutils literal notranslate"><span class="pre">utcnow()</span></code></a>:
use <code class="docutils literal notranslate"><span class="pre">datetime.datetime.now(tz=datetime.UTC)</span></code>.</p></li>
<li><p><a class="reference internal" href="../library/datetime.html#datetime.datetime.utcfromtimestamp" title="datetime.datetime.utcfromtimestamp"><code class="xref py py-meth docutils literal notranslate"><span class="pre">utcfromtimestamp()</span></code></a>:
use <code class="docutils literal notranslate"><span class="pre">datetime.datetime.fromtimestamp(timestamp,</span> <span class="pre">tz=datetime.UTC)</span></code>.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/gettext.html#module-gettext" title="gettext: Multilingual internationalization services."><code class="xref py py-mod docutils literal notranslate"><span class="pre">gettext</span></code></a>: Plural value must be an integer.</p></li>
<li><p><a class="reference internal" href="../library/importlib.html#module-importlib" title="importlib: The implementation of the import machinery."><code class="xref py py-mod docutils literal notranslate"><span class="pre">importlib</span></code></a>:</p>
<ul>
<li><p><a class="reference internal" href="../library/importlib.html#importlib.util.cache_from_source" title="importlib.util.cache_from_source"><code class="xref py py-func docutils literal notranslate"><span class="pre">cache_from_source()</span></code></a> <em>debug_override</em> parameter is
deprecated: use the <em>optimization</em> parameter instead.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/importlib.metadata.html#module-importlib.metadata" title="importlib.metadata: Accessing package metadata"><code class="xref py py-mod docutils literal notranslate"><span class="pre">importlib.metadata</span></code></a>:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">EntryPoints</span></code> tuple interface.</p></li>
<li><p>Implicit <code class="docutils literal notranslate"><span class="pre">None</span></code> on return values.</p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/logging.html#module-logging" title="logging: Flexible event logging system for applications."><code class="xref py py-mod docutils literal notranslate"><span class="pre">logging</span></code></a>: the <code class="docutils literal notranslate"><span class="pre">warn()</span></code> method has been deprecated
since Python 3.3, use <a class="reference internal" href="../library/logging.html#logging.warning" title="logging.warning"><code class="xref py py-meth docutils literal notranslate"><span class="pre">warning()</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../library/mailbox.html#module-mailbox" title="mailbox: Manipulate mailboxes in various formats"><code class="xref py py-mod docutils literal notranslate"><span class="pre">mailbox</span></code></a>: Use of StringIO input and text mode is deprecated, use
BytesIO and binary mode instead.</p></li>
<li><p><a class="reference internal" href="../library/os.html#module-os" title="os: Miscellaneous operating system interfaces."><code class="xref py py-mod docutils literal notranslate"><span class="pre">os</span></code></a>: Calling <a class="reference internal" href="../library/os.html#os.register_at_fork" title="os.register_at_fork"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.register_at_fork()</span></code></a> in multi-threaded process.</p></li>
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">pydoc.ErrorDuringImport</span></code>: A tuple value for <em>exc_info</em> parameter is
deprecated, use an exception instance.</p></li>
<li><p><a class="reference internal" href="../library/re.html#module-re" title="re: Regular expression operations."><code class="xref py py-mod docutils literal notranslate"><span class="pre">re</span></code></a>: More strict rules are now applied for numerical group references
and group names in regular expressions.  Only sequence of ASCII digits is now
accepted as a numerical reference.  The group name in bytes patterns and
replacement strings can now only contain ASCII letters and digits and
underscore.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/91760">gh-91760</a>.)</p></li>
<li><p><code class="xref py py-mod docutils literal notranslate"><span class="pre">sre_compile</span></code>, <code class="xref py py-mod docutils literal notranslate"><span class="pre">sre_constants</span></code> and <code class="xref py py-mod docutils literal notranslate"><span class="pre">sre_parse</span></code> modules.</p></li>
<li><p><a class="reference internal" href="../library/shutil.html#module-shutil" title="shutil: High-level file operations, including copying."><code class="xref py py-mod docutils literal notranslate"><span class="pre">shutil</span></code></a>: <a class="reference internal" href="../library/shutil.html#shutil.rmtree" title="shutil.rmtree"><code class="xref py py-func docutils literal notranslate"><span class="pre">rmtree()</span></code></a>’s <em>onerror</em> parameter is deprecated in
Python 3.12; use the <em>onexc</em> parameter instead.</p></li>
<li><p><a class="reference internal" href="../library/ssl.html#module-ssl" title="ssl: TLS/SSL wrapper for socket objects"><code class="xref py py-mod docutils literal notranslate"><span class="pre">ssl</span></code></a> options and protocols:</p>
<ul>
<li><p><a class="reference internal" href="../library/ssl.html#ssl.SSLContext" title="ssl.SSLContext"><code class="xref py py-class docutils literal notranslate"><span class="pre">ssl.SSLContext</span></code></a> without protocol argument is deprecated.</p></li>
<li><p><a class="reference internal" href="../library/ssl.html#ssl.SSLContext" title="ssl.SSLContext"><code class="xref py py-class docutils literal notranslate"><span class="pre">ssl.SSLContext</span></code></a>: <a class="reference internal" href="../library/ssl.html#ssl.SSLContext.set_npn_protocols" title="ssl.SSLContext.set_npn_protocols"><code class="xref py py-meth docutils literal notranslate"><span class="pre">set_npn_protocols()</span></code></a> and
<code class="xref py py-meth docutils literal notranslate"><span class="pre">selected_npn_protocol()</span></code> are deprecated: use ALPN
instead.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ssl.OP_NO_SSL*</span></code> options</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ssl.OP_NO_TLS*</span></code> options</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ssl.PROTOCOL_SSLv3</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ssl.PROTOCOL_TLS</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ssl.PROTOCOL_TLSv1</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ssl.PROTOCOL_TLSv1_1</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ssl.PROTOCOL_TLSv1_2</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ssl.TLSVersion.SSLv3</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ssl.TLSVersion.TLSv1</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ssl.TLSVersion.TLSv1_1</span></code></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="../library/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="c-api-deprecations">
<h2>C API deprecations<a class="headerlink" href="#c-api-deprecations" title="Link to this heading">¶</a></h2>
<section id="id1">
<h3>Pending removal in Python 3.15<a class="headerlink" href="#id1" title="Link to this heading">¶</a></h3>
<ul>
<li><p>The <a class="reference internal" href="../c-api/import.html#c.PyImport_ImportModuleNoBlock" title="PyImport_ImportModuleNoBlock"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyImport_ImportModuleNoBlock()</span></code></a>:
Use <a class="reference internal" href="../c-api/import.html#c.PyImport_ImportModule" title="PyImport_ImportModule"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyImport_ImportModule()</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/weakref.html#c.PyWeakref_GetObject" title="PyWeakref_GetObject"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyWeakref_GetObject()</span></code></a> and <a class="reference internal" href="../c-api/weakref.html#c.PyWeakref_GET_OBJECT" title="PyWeakref_GET_OBJECT"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyWeakref_GET_OBJECT()</span></code></a>:
Use <a class="reference internal" href="../c-api/weakref.html#c.PyWeakref_GetRef" title="PyWeakref_GetRef"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyWeakref_GetRef()</span></code></a> instead. 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/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> on Python 3.12 and older.</p></li>
<li><p><a class="reference internal" href="../c-api/unicode.html#c.Py_UNICODE" title="Py_UNICODE"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_UNICODE</span></code></a> type and the <code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_UNICODE_WIDE</span></code> macro:
Use <code class="xref c c-type docutils literal notranslate"><span class="pre">wchar_t</span></code> instead.</p></li>
<li><p><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="../library/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="../library/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="../library/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="../library/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><a class="reference internal" href="../c-api/init.html#c.Py_GetPath" title="Py_GetPath"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetPath()</span></code></a>:
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><a class="reference internal" href="../c-api/init.html#c.Py_GetPrefix" title="Py_GetPrefix"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetPrefix()</span></code></a>:
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 <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;prefix&quot;)</span></code></a> (<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><a class="reference internal" href="../c-api/init.html#c.Py_GetExecPrefix" title="Py_GetExecPrefix"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetExecPrefix()</span></code></a>:
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
<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;exec_prefix&quot;)</span></code></a>
(<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><a class="reference internal" href="../c-api/init.html#c.Py_GetProgramFullPath" title="Py_GetProgramFullPath"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetProgramFullPath()</span></code></a>:
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><a class="reference internal" href="../c-api/init.html#c.Py_GetProgramName" title="Py_GetProgramName"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetProgramName()</span></code></a>:
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><a class="reference internal" href="../c-api/init.html#c.Py_GetPythonHome" title="Py_GetPythonHome"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_GetPythonHome()</span></code></a>:
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-4"></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><a class="reference internal" href="../c-api/sys.html#c.PySys_ResetWarnOptions" title="PySys_ResetWarnOptions"><code class="xref c c-func docutils literal notranslate"><span class="pre">PySys_ResetWarnOptions()</span></code></a>:
Clear <a class="reference internal" href="../library/sys.html#sys.warnoptions" title="sys.warnoptions"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.warnoptions</span></code></a> and <code class="xref py py-data docutils literal notranslate"><span class="pre">warnings.filters</span></code> instead.</p></li>
</ul>
<p>The <a class="reference internal" href="../c-api/init.html#c.Py_InitializeFromConfig" title="Py_InitializeFromConfig"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_InitializeFromConfig()</span></code></a> API should be used with
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig" title="PyConfig"><code class="xref c c-type docutils literal notranslate"><span class="pre">PyConfig</span></code></a> instead.</p>
</li>
<li><p>Global configuration variables:</p>
<ul class="simple">
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_DebugFlag" title="Py_DebugFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_DebugFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.parser_debug" title="PyConfig.parser_debug"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.parser_debug</span></code></a> 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/init.html#c.Py_VerboseFlag" title="Py_VerboseFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_VerboseFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.verbose" title="PyConfig.verbose"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.verbose</span></code></a> 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/init.html#c.Py_QuietFlag" title="Py_QuietFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_QuietFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.quiet" title="PyConfig.quiet"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.quiet</span></code></a> 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/init.html#c.Py_InteractiveFlag" title="Py_InteractiveFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_InteractiveFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.interactive" title="PyConfig.interactive"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.interactive</span></code></a> 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/init.html#c.Py_InspectFlag" title="Py_InspectFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_InspectFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.inspect" title="PyConfig.inspect"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.inspect</span></code></a> 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/init.html#c.Py_OptimizeFlag" title="Py_OptimizeFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_OptimizeFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.optimization_level" title="PyConfig.optimization_level"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.optimization_level</span></code></a> 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/init.html#c.Py_NoSiteFlag" title="Py_NoSiteFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_NoSiteFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.site_import" title="PyConfig.site_import"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.site_import</span></code></a> 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/init.html#c.Py_BytesWarningFlag" title="Py_BytesWarningFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_BytesWarningFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.bytes_warning" title="PyConfig.bytes_warning"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.bytes_warning</span></code></a> 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/init.html#c.Py_FrozenFlag" title="Py_FrozenFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_FrozenFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.pathconfig_warnings" title="PyConfig.pathconfig_warnings"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.pathconfig_warnings</span></code></a> 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/init.html#c.Py_IgnoreEnvironmentFlag" title="Py_IgnoreEnvironmentFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_IgnoreEnvironmentFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.use_environment" title="PyConfig.use_environment"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.use_environment</span></code></a> 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/init.html#c.Py_DontWriteBytecodeFlag" title="Py_DontWriteBytecodeFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_DontWriteBytecodeFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.write_bytecode" title="PyConfig.write_bytecode"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.write_bytecode</span></code></a> 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/init.html#c.Py_NoUserSiteDirectory" title="Py_NoUserSiteDirectory"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_NoUserSiteDirectory</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.user_site_directory" title="PyConfig.user_site_directory"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.user_site_directory</span></code></a> 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/init.html#c.Py_UnbufferedStdioFlag" title="Py_UnbufferedStdioFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_UnbufferedStdioFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.buffered_stdio" title="PyConfig.buffered_stdio"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.buffered_stdio</span></code></a> 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/init.html#c.Py_HashRandomizationFlag" title="Py_HashRandomizationFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_HashRandomizationFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.use_hash_seed" title="PyConfig.use_hash_seed"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.use_hash_seed</span></code></a>
and <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.hash_seed" title="PyConfig.hash_seed"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.hash_seed</span></code></a> 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/init.html#c.Py_IsolatedFlag" title="Py_IsolatedFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_IsolatedFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.isolated" title="PyConfig.isolated"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.isolated</span></code></a> 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/init.html#c.Py_LegacyWindowsFSEncodingFlag" title="Py_LegacyWindowsFSEncodingFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_LegacyWindowsFSEncodingFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyPreConfig.legacy_windows_fs_encoding" title="PyPreConfig.legacy_windows_fs_encoding"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyPreConfig.legacy_windows_fs_encoding</span></code></a> 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/init.html#c.Py_LegacyWindowsStdioFlag" title="Py_LegacyWindowsStdioFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_LegacyWindowsStdioFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.legacy_windows_stdio" title="PyConfig.legacy_windows_stdio"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.legacy_windows_stdio</span></code></a> 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/init.html#c.Py_InitializeFromConfig" title="Py_InitializeFromConfig"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_InitializeFromConfig()</span></code></a> API should be used with
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig" title="PyConfig"><code class="xref c c-type docutils literal notranslate"><span class="pre">PyConfig</span></code></a> 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="pending-removal-in-python-3-18">
<h3>Pending removal in Python 3.18<a class="headerlink" href="#pending-removal-in-python-3-18" 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/init.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="id2">
<h3>Pending removal in future versions<a class="headerlink" href="#id2" 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/init.html#c.PyThread_create_key" title="PyThread_create_key"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_create_key()</span></code></a>:
Use <a class="reference internal" href="../c-api/init.html#c.PyThread_tss_alloc" title="PyThread_tss_alloc"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_tss_alloc()</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.PyThread_delete_key" title="PyThread_delete_key"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_delete_key()</span></code></a>:
Use <a class="reference internal" href="../c-api/init.html#c.PyThread_tss_free" title="PyThread_tss_free"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_tss_free()</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.PyThread_set_key_value" title="PyThread_set_key_value"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_set_key_value()</span></code></a>:
Use <a class="reference internal" href="../c-api/init.html#c.PyThread_tss_set" title="PyThread_tss_set"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_tss_set()</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.PyThread_get_key_value" title="PyThread_get_key_value"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_get_key_value()</span></code></a>:
Use <a class="reference internal" href="../c-api/init.html#c.PyThread_tss_get" title="PyThread_tss_get"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_tss_get()</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.PyThread_delete_key_value" title="PyThread_delete_key_value"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_delete_key_value()</span></code></a>:
Use <a class="reference internal" href="../c-api/init.html#c.PyThread_tss_delete" title="PyThread_tss_delete"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_tss_delete()</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.PyThread_ReInitTLS" title="PyThread_ReInitTLS"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyThread_ReInitTLS()</span></code></a>:
Unneeded since Python 3.7.</p></li>
</ul>
</li>
</ul>
</section>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="Main">
        <div class="sphinxsidebarwrapper">
  <div>
    <h3><a href="../contents.html">Table of Contents</a></h3>
    <ul>
<li><a class="reference internal" href="#">Deprecations</a><ul>
<li><a class="reference internal" href="#pending-removal-in-python-3-15">Pending removal in Python 3.15</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-16">Pending removal in Python 3.16</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-17">Pending removal in Python 3.17</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-future-versions">Pending removal in future versions</a></li>
<li><a class="reference internal" href="#c-api-deprecations">C API deprecations</a><ul>
<li><a class="reference internal" href="#id1">Pending removal in Python 3.15</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="#id2">Pending removal in future versions</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  </div>
  <div>
    <h4>Previous topic</h4>
    <p class="topless"><a href="../faq/installed.html"
                          title="previous chapter">“Why is Python Installed on my Computer?” FAQ</a></p>
  </div>
  <div>
    <h4>Next topic</h4>
    <p class="topless"><a href="../glossary.html"
                          title="next chapter">Glossary</a></p>
  </div>
  <div role="note" aria-label="source link">
    <h3>This page</h3>
    <ul class="this-page-menu">
      <li><a href="../bugs.html">Report a bug</a></li>
      <li>
        <a href="https://github.com/python/cpython/blob/main/Doc/deprecations/index.rst?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><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.14.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 07, 2025 (10:02 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>