Mini Kabibi Habibi
<!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="What’s new in Python 3.14" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://docs.python.org/3/whatsnew/3.14.html" />
<meta property="og:site_name" content="Python documentation" />
<meta property="og:description" content="Editors, Adam Turner and Hugo van Kemenade,. This article explains the new features in Python 3.14, compared to 3.13. Python 3.14 was released on 7 October 2025. For full details, see the changelog..." />
<meta property="og:image" content="_static/og-image.png" />
<meta property="og:image:alt" content="Python documentation" />
<meta name="description" content="Editors, Adam Turner and Hugo van Kemenade,. This article explains the new features in Python 3.14, compared to 3.13. Python 3.14 was released on 7 October 2025. For full details, see the changelog..." />
<meta name="theme-color" content="#3776ab">
<meta property="og:image:width" content="200">
<meta property="og:image:height" content="200">
<title>What’s new in Python 3.14 — 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="What’s New In Python 3.13" href="3.13.html" />
<link rel="prev" title="What’s New in Python" href="index.html" />
<link rel="canonical" href="https://docs.python.org/3/whatsnew/3.14.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="#">What’s new in Python 3.14</a><ul>
<li><a class="reference internal" href="#summary-release-highlights">Summary – Release highlights</a></li>
<li><a class="reference internal" href="#new-features">New features</a><ul>
<li><a class="reference internal" href="#pep-649-pep-749-deferred-evaluation-of-annotations"><strong>PEP 649</strong> & <strong>PEP 749</strong>: Deferred evaluation of annotations</a></li>
<li><a class="reference internal" href="#pep-734-multiple-interpreters-in-the-standard-library"><strong>PEP 734</strong>: Multiple interpreters in the standard library</a></li>
<li><a class="reference internal" href="#pep-750-template-string-literals"><strong>PEP 750</strong>: Template string literals</a></li>
<li><a class="reference internal" href="#pep-768-safe-external-debugger-interface"><strong>PEP 768</strong>: Safe external debugger interface</a></li>
<li><a class="reference internal" href="#a-new-type-of-interpreter">A new type of interpreter</a></li>
<li><a class="reference internal" href="#free-threaded-mode-improvements">Free-threaded mode improvements</a></li>
<li><a class="reference internal" href="#improved-error-messages">Improved error messages</a></li>
<li><a class="reference internal" href="#pep-784-zstandard-support-in-the-standard-library"><strong>PEP 784</strong>: Zstandard support in the standard library</a></li>
<li><a class="reference internal" href="#asyncio-introspection-capabilities">Asyncio introspection capabilities</a></li>
<li><a class="reference internal" href="#concurrent-safe-warnings-control">Concurrent safe warnings control</a></li>
</ul>
</li>
<li><a class="reference internal" href="#other-language-changes">Other language changes</a><ul>
<li><a class="reference internal" href="#built-ins">Built-ins</a></li>
<li><a class="reference internal" href="#command-line-and-environment">Command line and environment</a></li>
<li><a class="reference internal" href="#pep-758-allow-except-and-except-expressions-without-brackets">PEP 758: Allow <code class="docutils literal notranslate"><span class="pre">except</span></code> and <code class="docutils literal notranslate"><span class="pre">except*</span></code> expressions without brackets</a></li>
<li><a class="reference internal" href="#pep-765-control-flow-in-finally-blocks">PEP 765: Control flow in <code class="xref std std-keyword docutils literal notranslate"><span class="pre">finally</span></code> blocks</a></li>
<li><a class="reference internal" href="#incremental-garbage-collection">Incremental garbage collection</a></li>
<li><a class="reference internal" href="#default-interactive-shell">Default interactive shell</a></li>
</ul>
</li>
<li><a class="reference internal" href="#new-modules">New modules</a></li>
<li><a class="reference internal" href="#improved-modules">Improved modules</a><ul>
<li><a class="reference internal" href="#argparse">argparse</a></li>
<li><a class="reference internal" href="#ast">ast</a></li>
<li><a class="reference internal" href="#asyncio">asyncio</a></li>
<li><a class="reference internal" href="#calendar">calendar</a></li>
<li><a class="reference internal" href="#concurrent-futures">concurrent.futures</a></li>
<li><a class="reference internal" href="#configparser">configparser</a></li>
<li><a class="reference internal" href="#contextvars">contextvars</a></li>
<li><a class="reference internal" href="#ctypes">ctypes</a></li>
<li><a class="reference internal" href="#curses">curses</a></li>
<li><a class="reference internal" href="#datetime">datetime</a></li>
<li><a class="reference internal" href="#decimal">decimal</a></li>
<li><a class="reference internal" href="#difflib">difflib</a></li>
<li><a class="reference internal" href="#dis">dis</a></li>
<li><a class="reference internal" href="#errno">errno</a></li>
<li><a class="reference internal" href="#faulthandler">faulthandler</a></li>
<li><a class="reference internal" href="#fnmatch">fnmatch</a></li>
<li><a class="reference internal" href="#fractions">fractions</a></li>
<li><a class="reference internal" href="#functools">functools</a></li>
<li><a class="reference internal" href="#getopt">getopt</a></li>
<li><a class="reference internal" href="#getpass">getpass</a></li>
<li><a class="reference internal" href="#graphlib">graphlib</a></li>
<li><a class="reference internal" href="#heapq">heapq</a></li>
<li><a class="reference internal" href="#hmac">hmac</a></li>
<li><a class="reference internal" href="#http">http</a></li>
<li><a class="reference internal" href="#imaplib">imaplib</a></li>
<li><a class="reference internal" href="#inspect">inspect</a></li>
<li><a class="reference internal" href="#io">io</a></li>
<li><a class="reference internal" href="#json">json</a></li>
<li><a class="reference internal" href="#linecache">linecache</a></li>
<li><a class="reference internal" href="#logging-handlers">logging.handlers</a></li>
<li><a class="reference internal" href="#math">math</a></li>
<li><a class="reference internal" href="#mimetypes">mimetypes</a></li>
<li><a class="reference internal" href="#multiprocessing">multiprocessing</a></li>
<li><a class="reference internal" href="#operator">operator</a></li>
<li><a class="reference internal" href="#os">os</a></li>
<li><a class="reference internal" href="#os-path">os.path</a></li>
<li><a class="reference internal" href="#pathlib">pathlib</a></li>
<li><a class="reference internal" href="#pdb">pdb</a></li>
<li><a class="reference internal" href="#pickle">pickle</a></li>
<li><a class="reference internal" href="#platform">platform</a></li>
<li><a class="reference internal" href="#pydoc">pydoc</a></li>
<li><a class="reference internal" href="#re">re</a></li>
<li><a class="reference internal" href="#socket">socket</a></li>
<li><a class="reference internal" href="#ssl">ssl</a></li>
<li><a class="reference internal" href="#struct">struct</a></li>
<li><a class="reference internal" href="#symtable">symtable</a></li>
<li><a class="reference internal" href="#sys">sys</a></li>
<li><a class="reference internal" href="#sys-monitoring">sys.monitoring</a></li>
<li><a class="reference internal" href="#sysconfig">sysconfig</a></li>
<li><a class="reference internal" href="#tarfile">tarfile</a></li>
<li><a class="reference internal" href="#threading">threading</a></li>
<li><a class="reference internal" href="#tkinter">tkinter</a></li>
<li><a class="reference internal" href="#turtle">turtle</a></li>
<li><a class="reference internal" href="#types">types</a></li>
<li><a class="reference internal" href="#typing">typing</a></li>
<li><a class="reference internal" href="#unicodedata">unicodedata</a></li>
<li><a class="reference internal" href="#unittest">unittest</a></li>
<li><a class="reference internal" href="#urllib">urllib</a></li>
<li><a class="reference internal" href="#uuid">uuid</a></li>
<li><a class="reference internal" href="#webbrowser">webbrowser</a></li>
<li><a class="reference internal" href="#zipfile">zipfile</a></li>
</ul>
</li>
<li><a class="reference internal" href="#optimizations">Optimizations</a><ul>
<li><a class="reference internal" href="#id2">asyncio</a></li>
<li><a class="reference internal" href="#base64">base64</a></li>
<li><a class="reference internal" href="#bdb">bdb</a></li>
<li><a class="reference internal" href="#id3">difflib</a></li>
<li><a class="reference internal" href="#gc">gc</a></li>
<li><a class="reference internal" href="#id4">io</a></li>
<li><a class="reference internal" href="#id5">pathlib</a></li>
<li><a class="reference internal" href="#id6">pdb</a></li>
<li><a class="reference internal" href="#id7">uuid</a></li>
<li><a class="reference internal" href="#zlib">zlib</a></li>
</ul>
</li>
<li><a class="reference internal" href="#removed">Removed</a><ul>
<li><a class="reference internal" href="#id8">argparse</a></li>
<li><a class="reference internal" href="#id9">ast</a></li>
<li><a class="reference internal" href="#id10">asyncio</a></li>
<li><a class="reference internal" href="#email">email</a></li>
<li><a class="reference internal" href="#importlib-abc">importlib.abc</a></li>
<li><a class="reference internal" href="#itertools">itertools</a></li>
<li><a class="reference internal" href="#id11">pathlib</a></li>
<li><a class="reference internal" href="#pkgutil">pkgutil</a></li>
<li><a class="reference internal" href="#pty">pty</a></li>
<li><a class="reference internal" href="#sqlite3">sqlite3</a></li>
<li><a class="reference internal" href="#id12">urllib</a></li>
</ul>
</li>
<li><a class="reference internal" href="#deprecated">Deprecated</a><ul>
<li><a class="reference internal" href="#new-deprecations">New deprecations</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-15">Pending removal in Python 3.15</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-16">Pending removal in Python 3.16</a></li>
<li><a class="reference internal" href="#pending-removal-in-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>
</ul>
</li>
<li><a class="reference internal" href="#cpython-bytecode-changes">CPython bytecode changes</a><ul>
<li><a class="reference internal" href="#pseudo-instructions">Pseudo-instructions</a></li>
</ul>
</li>
<li><a class="reference internal" href="#c-api-changes">C API changes</a><ul>
<li><a class="reference internal" href="#python-configuration-c-api">Python configuration C API</a></li>
<li><a class="reference internal" href="#new-features-in-the-c-api">New features in the C API</a></li>
<li><a class="reference internal" href="#limited-c-api-changes">Limited C API changes</a></li>
<li><a class="reference internal" href="#removed-c-apis">Removed C APIs</a></li>
<li><a class="reference internal" href="#deprecated-c-apis">Deprecated C APIs</a><ul>
<li><a class="reference internal" href="#id13">Pending removal in Python 3.15</a></li>
<li><a class="reference internal" href="#id14">Pending removal in Python 3.16</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="#id15">Pending removal in future versions</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#build-changes">Build changes</a><ul>
<li><a class="reference internal" href="#build-details-json"><code class="file docutils literal notranslate"><span class="pre">build-details.json</span></code></a></li>
<li><a class="reference internal" href="#discontinuation-of-pgp-signatures">Discontinuation of PGP signatures</a></li>
<li><a class="reference internal" href="#free-threaded-python-is-officially-supported">Free-threaded Python is officially supported</a></li>
<li><a class="reference internal" href="#binary-releases-for-the-experimental-just-in-time-compiler">Binary releases for the experimental just-in-time compiler</a></li>
</ul>
</li>
<li><a class="reference internal" href="#porting-to-python-3-14">Porting to Python 3.14</a><ul>
<li><a class="reference internal" href="#changes-in-the-python-api">Changes in the Python API</a></li>
<li><a class="reference internal" href="#changes-in-annotations-pep-649-and-pep-749">Changes in annotations (<strong>PEP 649</strong> and <strong>PEP 749</strong>)</a><ul>
<li><a class="reference internal" href="#implications-for-annotated-code">Implications for annotated code</a></li>
<li><a class="reference internal" href="#implications-for-readers-of-annotations">Implications for readers of <code class="docutils literal notranslate"><span class="pre">__annotations__</span></code></a></li>
<li><a class="reference internal" href="#related-changes">Related changes</a></li>
<li><a class="reference internal" href="#from-future-import-annotations"><code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">__future__</span> <span class="pre">import</span> <span class="pre">annotations</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#changes-in-the-c-api">Changes in the C API</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="index.html"
title="previous chapter">What’s New in Python</a></p>
</div>
<div>
<h4>Next topic</h4>
<p class="topless"><a href="3.13.html"
title="next chapter">What’s New In Python 3.13</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/whatsnew/3.14.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="3.13.html" title="What’s New In Python 3.13"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="index.html" title="What’s New in Python"
accesskey="P">previous</a> |</li>
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>
<li><a href="https://www.python.org/">Python</a> »</li>
<li class="switchers">
<div class="language_switcher_placeholder"></div>
<div class="version_switcher_placeholder"></div>
</li>
<li>
</li>
<li id="cpython-language-and-version">
<a href="../index.html">3.14.0 Documentation</a> »
</li>
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">What’s New in Python</a> »</li>
<li class="nav-item nav-item-this"><a href="">What’s new in Python 3.14</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="what-s-new-in-python-3-14">
<h1>What’s new in Python 3.14<a class="headerlink" href="#what-s-new-in-python-3-14" title="Link to this heading">¶</a></h1>
<dl class="field-list simple">
<dt class="field-odd">Editors<span class="colon">:</span></dt>
<dd class="field-odd"><p>Adam Turner and Hugo van Kemenade</p>
</dd>
</dl>
<p>This article explains the new features in Python 3.14, compared to 3.13.
Python 3.14 was released on 7 October 2025.
For full details, see the <a class="reference internal" href="changelog.html#changelog"><span class="std std-ref">changelog</span></a>.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><span class="target" id="index-0"></span><a class="pep reference external" href="https://peps.python.org/pep-0745/"><strong>PEP 745</strong></a> – Python 3.14 release schedule</p>
</div>
<section id="summary-release-highlights">
<h2>Summary – Release highlights<a class="headerlink" href="#summary-release-highlights" title="Link to this heading">¶</a></h2>
<p>Python 3.14 is the latest stable release of the Python programming
language, with a mix of changes to the language, the implementation,
and the standard library.
The biggest changes include <a class="reference internal" href="#whatsnew314-template-string-literals"><span class="std std-ref">template string literals</span></a>,
<a class="reference internal" href="#whatsnew314-deferred-annotations"><span class="std std-ref">deferred evaluation of annotations</span></a>,
and support for <a class="reference internal" href="#whatsnew314-multiple-interpreters"><span class="std std-ref">subinterpreters</span></a> in
the standard library.</p>
<p>The library changes include significantly improved capabilities for
<a class="reference internal" href="#whatsnew314-asyncio-introspection"><span class="std std-ref">introspection in asyncio</span></a>,
<a class="reference internal" href="#whatsnew314-zstandard"><span class="std std-ref">support for Zstandard</span></a> via a new
<a class="reference internal" href="../library/compression.zstd.html#module-compression.zstd" title="compression.zstd: Low-level interface to compression and decompression routines in the zstd library."><code class="xref py py-mod docutils literal notranslate"><span class="pre">compression.zstd</span></code></a> module, syntax highlighting in the REPL,
as well as the usual deprecations and removals,
and improvements in user-friendliness and correctness.</p>
<p>This article doesn’t attempt to provide a complete specification
of all new features, but instead gives a convenient overview.
For full details refer to the documentation,
such as the <a class="reference internal" href="../library/index.html#library-index"><span class="std std-ref">Library Reference</span></a>
and <a class="reference internal" href="../reference/index.html#reference-index"><span class="std std-ref">Language Reference</span></a>.
To understand the complete implementation and design rationale for a change,
refer to the PEP for a particular new feature;
but note that PEPs usually are not kept up-to-date
once a feature has been fully implemented.
See <a class="reference internal" href="#porting-to-python-3-14">Porting to Python 3.14</a> for guidance on upgrading from
earlier versions of Python.</p>
<hr class="docutils" />
<p>Interpreter improvements:</p>
<ul class="simple">
<li><p><span class="target" id="index-1"></span><a class="pep reference external" href="https://peps.python.org/pep-0649/"><strong>PEP 649</strong></a> and <span class="target" id="index-2"></span><a class="pep reference external" href="https://peps.python.org/pep-0749/"><strong>PEP 749</strong></a>: <a class="reference internal" href="#whatsnew314-deferred-annotations"><span class="std std-ref">Deferred evaluation of annotations</span></a></p></li>
<li><p><span class="target" id="index-3"></span><a class="pep reference external" href="https://peps.python.org/pep-0734/"><strong>PEP 734</strong></a>: <a class="reference internal" href="#whatsnew314-multiple-interpreters"><span class="std std-ref">Multiple interpreters in the standard library</span></a></p></li>
<li><p><span class="target" id="index-4"></span><a class="pep reference external" href="https://peps.python.org/pep-0750/"><strong>PEP 750</strong></a>: <a class="reference internal" href="#whatsnew314-template-string-literals"><span class="std std-ref">Template strings</span></a></p></li>
<li><p><span class="target" id="index-5"></span><a class="pep reference external" href="https://peps.python.org/pep-0758/"><strong>PEP 758</strong></a>: <a class="reference internal" href="#whatsnew314-bracketless-except"><span class="std std-ref">Allow except and except* expressions without brackets</span></a></p></li>
<li><p><span class="target" id="index-6"></span><a class="pep reference external" href="https://peps.python.org/pep-0765/"><strong>PEP 765</strong></a>: <a class="reference internal" href="#whatsnew314-finally-syntaxwarning"><span class="std std-ref">Control flow in finally blocks</span></a></p></li>
<li><p><span class="target" id="index-7"></span><a class="pep reference external" href="https://peps.python.org/pep-0768/"><strong>PEP 768</strong></a>: <a class="reference internal" href="#whatsnew314-remote-debugging"><span class="std std-ref">Safe external debugger interface for CPython</span></a></p></li>
<li><p><a class="reference internal" href="#whatsnew314-tail-call-interpreter"><span class="std std-ref">A new type of interpreter</span></a></p></li>
<li><p><a class="reference internal" href="#whatsnew314-free-threaded-cpython"><span class="std std-ref">Free-threaded mode improvements</span></a></p></li>
<li><p><a class="reference internal" href="#whatsnew314-improved-error-messages"><span class="std std-ref">Improved error messages</span></a></p></li>
<li><p><a class="reference internal" href="#whatsnew314-incremental-gc"><span class="std std-ref">Incremental garbage collection</span></a></p></li>
</ul>
<p>Significant improvements in the standard library:</p>
<ul class="simple">
<li><p><span class="target" id="index-8"></span><a class="pep reference external" href="https://peps.python.org/pep-0784/"><strong>PEP 784</strong></a>: <a class="reference internal" href="#whatsnew314-zstandard"><span class="std std-ref">Zstandard support in the standard library</span></a></p></li>
<li><p><a class="reference internal" href="#whatsnew314-asyncio-introspection"><span class="std std-ref">Asyncio introspection capabilities</span></a></p></li>
<li><p><a class="reference internal" href="#whatsnew314-concurrent-warnings-control"><span class="std std-ref">Concurrent safe warnings control</span></a></p></li>
<li><p><a class="reference internal" href="#whatsnew314-pyrepl-highlighting"><span class="std std-ref">Syntax highlighting in the default interactive shell</span></a>, and color output in several
standard library CLIs</p></li>
</ul>
<p>C API improvements:</p>
<ul class="simple">
<li><p><span class="target" id="index-9"></span><a class="pep reference external" href="https://peps.python.org/pep-0741/"><strong>PEP 741</strong></a>: <a class="reference internal" href="#whatsnew314-capi-config"><span class="std std-ref">Python configuration C API</span></a></p></li>
</ul>
<p>Platform support:</p>
<ul class="simple">
<li><p><span class="target" id="index-10"></span><a class="pep reference external" href="https://peps.python.org/pep-0776/"><strong>PEP 776</strong></a>: Emscripten is now an <a class="reference internal" href="#whatsnew314-build-changes"><span class="std std-ref">officially supported platform</span></a>, at <span class="target" id="index-11"></span><a class="pep reference external" href="https://peps.python.org/pep-0011/#tier-3"><strong>tier 3</strong></a>.</p></li>
</ul>
<p>Release changes:</p>
<ul class="simple">
<li><p><span class="target" id="index-12"></span><a class="pep reference external" href="https://peps.python.org/pep-0779/"><strong>PEP 779</strong></a>: <a class="reference internal" href="#whatsnew314-free-threaded-now-supported"><span class="std std-ref">Free-threaded Python is officially supported</span></a></p></li>
<li><p><span class="target" id="index-13"></span><a class="pep reference external" href="https://peps.python.org/pep-0761/"><strong>PEP 761</strong></a>: <a class="reference internal" href="#whatsnew314-no-more-pgp"><span class="std std-ref">PGP signatures have been discontinued for official releases</span></a></p></li>
<li><p><a class="reference internal" href="#whatsnew314-jit-compiler"><span class="std std-ref">Windows and macOS binary releases now support the experimental
just-in-time compiler</span></a></p></li>
<li><p><a class="reference internal" href="#whatsnew314-build-changes"><span class="std std-ref">Binary releases for Android are now provided</span></a></p></li>
</ul>
</section>
<section id="new-features">
<h2>New features<a class="headerlink" href="#new-features" title="Link to this heading">¶</a></h2>
<section id="pep-649-pep-749-deferred-evaluation-of-annotations">
<span id="whatsnew314-deferred-annotations"></span><h3><span class="target" id="index-14"></span><a class="pep reference external" href="https://peps.python.org/pep-0649/"><strong>PEP 649</strong></a> & <span class="target" id="index-15"></span><a class="pep reference external" href="https://peps.python.org/pep-0749/"><strong>PEP 749</strong></a>: Deferred evaluation of annotations<a class="headerlink" href="#pep-649-pep-749-deferred-evaluation-of-annotations" title="Link to this heading">¶</a></h3>
<p>The <a class="reference internal" href="../glossary.html#term-annotation"><span class="xref std std-term">annotations</span></a> on functions, classes, and modules are no
longer evaluated eagerly. Instead, annotations are stored in special-purpose
<a class="reference internal" href="../glossary.html#term-annotate-function"><span class="xref std std-term">annotate functions</span></a> and evaluated only when
necessary (except if <code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">__future__</span> <span class="pre">import</span> <span class="pre">annotations</span></code> is used).</p>
<p>This change is designed to improve performance and usability of annotations
in Python in most circumstances. The runtime cost for defining annotations is
minimized, but it remains possible to introspect annotations at runtime.
It is no longer necessary to enclose annotations in strings if they
contain forward references.</p>
<p>The new <a class="reference internal" href="../library/annotationlib.html#module-annotationlib" title="annotationlib: Functionality for introspecting annotations"><code class="xref py py-mod docutils literal notranslate"><span class="pre">annotationlib</span></code></a> module provides tools for inspecting deferred
annotations. Annotations may be evaluated in the <a class="reference internal" href="../library/annotationlib.html#annotationlib.Format.VALUE" title="annotationlib.Format.VALUE"><code class="xref py py-attr docutils literal notranslate"><span class="pre">VALUE</span></code></a>
format (which evaluates annotations to runtime values, similar to the behavior in
earlier Python versions), the <a class="reference internal" href="../library/annotationlib.html#annotationlib.Format.FORWARDREF" title="annotationlib.Format.FORWARDREF"><code class="xref py py-attr docutils literal notranslate"><span class="pre">FORWARDREF</span></code></a> format
(which replaces undefined names with special markers), and the
<a class="reference internal" href="../library/annotationlib.html#annotationlib.Format.STRING" title="annotationlib.Format.STRING"><code class="xref py py-attr docutils literal notranslate"><span class="pre">STRING</span></code></a> format (which returns annotations as strings).</p>
<p>This example shows how these formats behave:</p>
<div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span><span class="w"> </span><span class="nn">annotationlib</span><span class="w"> </span><span class="kn">import</span> <span class="n">get_annotations</span><span class="p">,</span> <span class="n">Format</span>
<span class="gp">>>> </span><span class="k">def</span><span class="w"> </span><span class="nf">func</span><span class="p">(</span><span class="n">arg</span><span class="p">:</span> <span class="n">Undefined</span><span class="p">):</span>
<span class="gp">... </span> <span class="k">pass</span>
<span class="gp">>>> </span><span class="n">get_annotations</span><span class="p">(</span><span class="n">func</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="n">Format</span><span class="o">.</span><span class="n">VALUE</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="w"> </span><span class="c">...</span>
<span class="gr">NameError</span>: <span class="n">name 'Undefined' is not defined</span>
<span class="gp">>>> </span><span class="n">get_annotations</span><span class="p">(</span><span class="n">func</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="n">Format</span><span class="o">.</span><span class="n">FORWARDREF</span><span class="p">)</span>
<span class="go">{'arg': ForwardRef('Undefined', owner=<function func at 0x...>)}</span>
<span class="gp">>>> </span><span class="n">get_annotations</span><span class="p">(</span><span class="n">func</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="n">Format</span><span class="o">.</span><span class="n">STRING</span><span class="p">)</span>
<span class="go">{'arg': 'Undefined'}</span>
</pre></div>
</div>
<p>The <a class="reference internal" href="#whatsnew314-porting-annotations"><span class="std std-ref">porting</span></a> section contains guidance
on changes that may be needed due to these changes, though in the majority of
cases, code will continue working as-is.</p>
<p>(Contributed by Jelle Zijlstra in <span class="target" id="index-16"></span><a class="pep reference external" href="https://peps.python.org/pep-0749/"><strong>PEP 749</strong></a> and <a class="reference external" href="https://github.com/python/cpython/issues/119180">gh-119180</a>;
<span class="target" id="index-17"></span><a class="pep reference external" href="https://peps.python.org/pep-0649/"><strong>PEP 649</strong></a> was written by Larry Hastings.)</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><span class="target" id="index-18"></span><a class="pep reference external" href="https://peps.python.org/pep-0649/"><strong>PEP 649</strong></a></dt><dd><p>Deferred Evaluation Of Annotations Using Descriptors</p>
</dd>
<dt><span class="target" id="index-19"></span><a class="pep reference external" href="https://peps.python.org/pep-0749/"><strong>PEP 749</strong></a></dt><dd><p>Implementing PEP 649</p>
</dd>
</dl>
</div>
</section>
<section id="pep-734-multiple-interpreters-in-the-standard-library">
<span id="whatsnew314-multiple-interpreters"></span><h3><span class="target" id="index-20"></span><a class="pep reference external" href="https://peps.python.org/pep-0734/"><strong>PEP 734</strong></a>: Multiple interpreters in the standard library<a class="headerlink" href="#pep-734-multiple-interpreters-in-the-standard-library" title="Link to this heading">¶</a></h3>
<p>The CPython runtime supports running multiple copies of Python in the
same process simultaneously and has done so for over 20 years.
Each of these separate copies is called an ‘interpreter’.
However, the feature had been available only through
the <a class="reference internal" href="../c-api/init.html#sub-interpreter-support"><span class="std std-ref">C-API</span></a>.</p>
<p>That limitation is removed in Python 3.14,
with the new <a class="reference internal" href="../library/concurrent.interpreters.html#module-concurrent.interpreters" title="concurrent.interpreters: Multiple interpreters in the same process"><code class="xref py py-mod docutils literal notranslate"><span class="pre">concurrent.interpreters</span></code></a> module.</p>
<p>There are at least two notable reasons why using multiple interpreters
has significant benefits:</p>
<ul class="simple">
<li><p>they support a new (to Python), human-friendly concurrency model</p></li>
<li><p>true multi-core parallelism</p></li>
</ul>
<p>For some use cases, concurrency in software enables efficiency and
can simplify design, at a high level.
At the same time, implementing and maintaining all but the simplest concurrency
is often a struggle for the human brain.
That especially applies to plain threads (for example, <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>),
where all memory is shared between all threads.</p>
<p>With multiple isolated interpreters, you can take advantage of a class
of concurrency models, like CSP or the actor model, that have found
success in other programming languages, like Smalltalk, Erlang,
Haskell, and Go. Think of multiple interpreters like threads
but with opt-in sharing.</p>
<p>Regarding multi-core parallelism: as of Python 3.12, interpreters
are now sufficiently isolated from one another to be used in parallel
(see <span class="target" id="index-21"></span><a class="pep reference external" href="https://peps.python.org/pep-0684/"><strong>PEP 684</strong></a>). This unlocks a variety of CPU-intensive use cases
for Python that were limited by the <a class="reference internal" href="../glossary.html#term-GIL"><span class="xref std std-term">GIL</span></a>.</p>
<p>Using multiple interpreters is similar in many ways to
<a class="reference internal" href="../library/multiprocessing.html#module-multiprocessing" title="multiprocessing: Process-based parallelism."><code class="xref py py-mod docutils literal notranslate"><span class="pre">multiprocessing</span></code></a>, in that they both provide isolated logical
“processes” that can run in parallel, with no sharing by default.
However, when using multiple interpreters, an application will use
fewer system resources and will operate more efficiently (since it
stays within the same process). Think of multiple interpreters as
having the isolation of processes with the efficiency of threads.</p>
<p>While the feature has been around for decades, multiple interpreters
have not been used widely, due to low awareness and the lack of a
standard library module. Consequently, they currently have several
notable limitations, which will improve significantly now that the
feature is finally going mainstream.</p>
<p>Current limitations:</p>
<ul class="simple">
<li><p>starting each interpreter has not been optimized yet</p></li>
<li><p>each interpreter uses more memory than necessary
(work continues on extensive internal sharing between interpreters)</p></li>
<li><p>there aren’t many options <em>yet</em> for truly sharing objects or other
data between interpreters (other than <a class="reference internal" href="../library/stdtypes.html#memoryview" title="memoryview"><code class="xref py py-type docutils literal notranslate"><span class="pre">memoryview</span></code></a>)</p></li>
<li><p>many third-party extension modules on PyPI are not yet compatible
with multiple interpreters
(all standard library extension modules <em>are</em> compatible)</p></li>
<li><p>the approach to writing applications that use multiple isolated
interpreters is mostly unfamiliar to Python users, for now</p></li>
</ul>
<p>The impact of these limitations will depend on future CPython
improvements, how interpreters are used, and what the community solves
through PyPI packages. Depending on the use case, the limitations may
not have much impact, so try it out!</p>
<p>Furthermore, future CPython releases will reduce or eliminate overhead
and provide utilities that are less appropriate on PyPI. In the
meantime, most of the limitations can also be addressed through
extension modules, meaning PyPI packages can fill any gap for 3.14, and
even back to 3.12 where interpreters were finally properly isolated and
stopped sharing the <a class="reference internal" href="../glossary.html#term-GIL"><span class="xref std std-term">GIL</span></a>. Likewise, libraries on PyPI are expected
to emerge for high-level abstractions on top of interpreters.</p>
<p>Regarding extension modules, work is in progress to update some PyPI
projects, as well as tools like Cython, pybind11, nanobind, and PyO3.
The steps for isolating an extension module are found at
<a class="reference internal" href="../howto/isolating-extensions.html#isolating-extensions-howto"><span class="std std-ref">Isolating Extension Modules</span></a>.
Isolating a module has a lot of overlap with what is required to support
<a class="reference internal" href="#whatsnew314-free-threaded-cpython"><span class="std std-ref">free-threading</span></a>, so the ongoing
work in the community in that area will help accelerate support
for multiple interpreters.</p>
<p>Also added in 3.14: <a class="reference internal" href="#whatsnew314-concurrent-futures-interp-pool"><span class="std std-ref">concurrent.futures.InterpreterPoolExecutor</span></a>.</p>
<p>(Contributed by Eric Snow in <a class="reference external" href="https://github.com/python/cpython/issues/134939">gh-134939</a>.)</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><span class="target" id="index-22"></span><a class="pep reference external" href="https://peps.python.org/pep-0734/"><strong>PEP 734</strong></a></p>
</div>
</section>
<section id="pep-750-template-string-literals">
<span id="whatsnew314-template-string-literals"></span><h3><span class="target" id="index-23"></span><a class="pep reference external" href="https://peps.python.org/pep-0750/"><strong>PEP 750</strong></a>: Template string literals<a class="headerlink" href="#pep-750-template-string-literals" title="Link to this heading">¶</a></h3>
<p>Template strings are a new mechanism for custom string processing.
They share the familiar syntax of f-strings but, unlike f-strings,
return an object representing the static and interpolated parts of
the string, instead of a simple <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>
<p>To write a t-string, use a <code class="docutils literal notranslate"><span class="pre">'t'</span></code> prefix instead of an <code class="docutils literal notranslate"><span class="pre">'f'</span></code>:</p>
<div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">variety</span> <span class="o">=</span> <span class="s1">'Stilton'</span>
<span class="gp">>>> </span><span class="n">template</span> <span class="o">=</span> <span class="n">t</span><span class="s1">'Try some </span><span class="si">{variety}</span><span class="s1"> cheese!'</span>
<span class="gp">>>> </span><span class="nb">type</span><span class="p">(</span><span class="n">template</span><span class="p">)</span>
<span class="go"><class 'string.templatelib.Template'></span>
</pre></div>
</div>
<p><a class="reference internal" href="../library/string.templatelib.html#string.templatelib.Template" title="string.templatelib.Template"><code class="xref py py-class docutils literal notranslate"><span class="pre">Template</span></code></a> objects provide access to the static
and interpolated (in curly braces) parts of a string <em>before</em> they are combined.
Iterate over <code class="xref py py-class docutils literal notranslate"><span class="pre">Template</span></code> instances to access their parts in order:</p>
<div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">template</span><span class="p">)</span>
<span class="go">['Try some ', Interpolation('Stilton', 'variety', None, ''), ' cheese!']</span>
</pre></div>
</div>
<p>It’s easy to write (or call) code to process <code class="xref py py-class docutils literal notranslate"><span class="pre">Template</span></code> instances.
For example, here’s a function that renders static parts lowercase and
<a class="reference internal" href="../library/string.templatelib.html#string.templatelib.Interpolation" title="string.templatelib.Interpolation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Interpolation</span></code></a> instances uppercase:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">string.templatelib</span><span class="w"> </span><span class="kn">import</span> <span class="n">Interpolation</span>
<span class="k">def</span><span class="w"> </span><span class="nf">lower_upper</span><span class="p">(</span><span class="n">template</span><span class="p">):</span>
<span class="w"> </span><span class="sd">"""Render static parts lowercase and interpolations uppercase."""</span>
<span class="n">parts</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">part</span> <span class="ow">in</span> <span class="n">template</span><span class="p">:</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">part</span><span class="p">,</span> <span class="n">Interpolation</span><span class="p">):</span>
<span class="n">parts</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">part</span><span class="o">.</span><span class="n">value</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">parts</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">part</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
<span class="k">return</span> <span class="s1">''</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">parts</span><span class="p">)</span>
<span class="n">name</span> <span class="o">=</span> <span class="s1">'Wenslydale'</span>
<span class="n">template</span> <span class="o">=</span> <span class="n">t</span><span class="s1">'Mister </span><span class="si">{name}</span><span class="s1">'</span>
<span class="k">assert</span> <span class="n">lower_upper</span><span class="p">(</span><span class="n">template</span><span class="p">)</span> <span class="o">==</span> <span class="s1">'mister WENSLYDALE'</span>
</pre></div>
</div>
<p>Because <code class="xref py py-class docutils literal notranslate"><span class="pre">Template</span></code> instances distinguish between static strings and
interpolations at runtime, they can be useful for sanitising user input.
Writing a <code class="xref py py-func docutils literal notranslate"><span class="pre">html()</span></code> function that escapes user input in HTML is an exercise
left to the reader!
Template processing code can provide improved flexibility.
For instance, a more advanced <code class="xref py py-func docutils literal notranslate"><span class="pre">html()</span></code> function could accept
a <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code> of HTML attributes directly in the template:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">attributes</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'src'</span><span class="p">:</span> <span class="s1">'limburger.jpg'</span><span class="p">,</span> <span class="s1">'alt'</span><span class="p">:</span> <span class="s1">'lovely cheese'</span><span class="p">}</span>
<span class="n">template</span> <span class="o">=</span> <span class="n">t</span><span class="s1">'<img </span><span class="si">{attributes}</span><span class="s1">>'</span>
<span class="k">assert</span> <span class="n">html</span><span class="p">(</span><span class="n">template</span><span class="p">)</span> <span class="o">==</span> <span class="s1">'<img src="limburger.jpg" alt="lovely cheese" />'</span>
</pre></div>
</div>
<p>Of course, template processing code does not need to return a string-like result.
An even <em>more</em> advanced <code class="xref py py-func docutils literal notranslate"><span class="pre">html()</span></code> could return a custom type representing
a DOM-like structure.</p>
<p>With t-strings in place, developers can write systems that sanitise SQL,
make safe shell operations, improve logging, tackle modern ideas in web
development (HTML, CSS, and so on), and implement lightweight custom business DSLs.</p>
<p>(Contributed by Jim Baker, Guido van Rossum, Paul Everitt, Koudai Aono,
Lysandros Nikolaou, Dave Peck, Adam Turner, Jelle Zijlstra, Bénédikt Tran,
and Pablo Galindo Salgado in <a class="reference external" href="https://github.com/python/cpython/issues/132661">gh-132661</a>.)</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><span class="target" id="index-24"></span><a class="pep reference external" href="https://peps.python.org/pep-0750/"><strong>PEP 750</strong></a>.</p>
</div>
</section>
<section id="pep-768-safe-external-debugger-interface">
<span id="whatsnew314-remote-debugging"></span><h3><span class="target" id="index-25"></span><a class="pep reference external" href="https://peps.python.org/pep-0768/"><strong>PEP 768</strong></a>: Safe external debugger interface<a class="headerlink" href="#pep-768-safe-external-debugger-interface" title="Link to this heading">¶</a></h3>
<p>Python 3.14 introduces a zero-overhead debugging interface that allows
debuggers and profilers to safely attach to running Python processes
without stopping or restarting them.
This is a significant enhancement to Python’s debugging capabilities,
meaning that unsafe alternatives are no longer required.</p>
<p>The new interface provides safe execution points for attaching debugger code
without modifying the interpreter’s normal execution path
or adding any overhead at runtime.
Due to this, tools can now inspect and interact with Python applications
in real-time, which is a crucial capability for high-availability systems
and production environments.</p>
<p>For convenience, this interface is implemented in the <a class="reference internal" href="../library/sys.html#sys.remote_exec" title="sys.remote_exec"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys.remote_exec()</span></code></a>
function. For example:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span><span class="w"> </span><span class="nn">sys</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">tempfile</span><span class="w"> </span><span class="kn">import</span> <span class="n">NamedTemporaryFile</span>
<span class="k">with</span> <span class="n">NamedTemporaryFile</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="s1">'w'</span><span class="p">,</span> <span class="n">suffix</span><span class="o">=</span><span class="s1">'.py'</span><span class="p">,</span> <span class="n">delete</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="n">script_path</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">name</span>
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">f</span><span class="s1">'import my_debugger; my_debugger.connect(</span><span class="si">{</span><span class="n">os</span><span class="o">.</span><span class="n">getpid</span><span class="p">()</span><span class="si">}</span><span class="s1">)'</span><span class="p">)</span>
<span class="c1"># Execute in process with PID 1234</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">'Behold! An offering:'</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">remote_exec</span><span class="p">(</span><span class="mi">1234</span><span class="p">,</span> <span class="n">script_path</span><span class="p">)</span>
</pre></div>
</div>
<p>This function allows sending Python code to be executed in a target process
at the next safe execution point.
However, tool authors can also implement the protocol directly as described
in the PEP, which details the underlying mechanisms used to safely attach to
running processes.</p>
<p>The debugging interface has been carefully designed with security in mind
and includes several mechanisms to control access:</p>
<ul class="simple">
<li><p>A <span class="target" id="index-26"></span><a class="reference internal" href="../using/cmdline.html#envvar-PYTHON_DISABLE_REMOTE_DEBUG"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHON_DISABLE_REMOTE_DEBUG</span></code></a> environment variable.</p></li>
<li><p>A <a class="reference internal" href="../using/cmdline.html#cmdoption-X"><code class="xref std std-option docutils literal notranslate"><span class="pre">-X</span> <span class="pre">disable-remote-debug</span></code></a> command-line option.</p></li>
<li><p>A <a class="reference internal" href="../using/configure.html#cmdoption-without-remote-debug"><code class="xref std std-option docutils literal notranslate"><span class="pre">--without-remote-debug</span></code></a> configure flag to completely disable
the feature at build time.</p></li>
</ul>
<p>(Contributed by Pablo Galindo Salgado, Matt Wozniski, and Ivona Stojanovic
in <a class="reference external" href="https://github.com/python/cpython/issues/131591">gh-131591</a>.)</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><span class="target" id="index-27"></span><a class="pep reference external" href="https://peps.python.org/pep-0768/"><strong>PEP 768</strong></a>.</p>
</div>
</section>
<section id="a-new-type-of-interpreter">
<span id="whatsnew314-tail-call-interpreter"></span><h3>A new type of interpreter<a class="headerlink" href="#a-new-type-of-interpreter" title="Link to this heading">¶</a></h3>
<p>A new type of interpreter has been added to CPython.
It uses tail calls between small C functions that implement individual
Python opcodes, rather than one large C <code class="docutils literal notranslate"><span class="pre">case</span></code> statement.
For certain newer compilers, this interpreter provides
significantly better performance. Preliminary benchmarks suggest a geometric
mean of 3-5% faster on the standard <code class="docutils literal notranslate"><span class="pre">pyperformance</span></code> benchmark suite,
depending on platform and architecture.
The baseline is Python 3.14 built with Clang 19, without this new interpreter.</p>
<p>This interpreter currently only works with Clang 19 and newer
on x86-64 and AArch64 architectures. However, a future release
of GCC is expected will support this as well.</p>
<p>This feature is opt-in for now. Enabling profile-guided optimization is highly
recommendeded when using the new interpreter as it is the only configuration
that has been tested and validated for improved performance.
For further information, see <a class="reference internal" href="../using/configure.html#cmdoption-with-tail-call-interp"><code class="xref std std-option docutils literal notranslate"><span class="pre">--with-tail-call-interp</span></code></a>.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This is not to be confused with <a class="reference external" href="https://en.wikipedia.org/wiki/Tail_call">tail call optimization</a> of Python
functions, which is currently not implemented in CPython.</p>
<p>This new interpreter type is an internal implementation detail of the CPython
interpreter. It doesn’t change the visible behavior of Python programs at
all. It can improve their performance, but doesn’t change anything else.</p>
</div>
<p>(Contributed by Ken Jin in <a class="reference external" href="https://github.com/python/cpython/issues/128563">gh-128563</a>, with ideas on how to implement this
in CPython by Mark Shannon, Garrett Gu, Haoran Xu, and Josh Haberman.)</p>
</section>
<section id="free-threaded-mode-improvements">
<span id="whatsnew314-free-threaded-cpython"></span><h3>Free-threaded mode improvements<a class="headerlink" href="#free-threaded-mode-improvements" title="Link to this heading">¶</a></h3>
<p>CPython’s free-threaded mode (<span class="target" id="index-28"></span><a class="pep reference external" href="https://peps.python.org/pep-0703/"><strong>PEP 703</strong></a>), initially added in 3.13,
has been significantly improved in Python 3.14.
The implementation described in PEP 703 has been finished, including C API
changes, and temporary workarounds in the interpreter were replaced with
more permanent solutions.
The specializing adaptive interpreter (<span class="target" id="index-29"></span><a class="pep reference external" href="https://peps.python.org/pep-0659/"><strong>PEP 659</strong></a>) is now enabled
in free-threaded mode, which along with many other optimizations
greatly improves its performance.
The performance penalty on single-threaded code in free-threaded mode
is now roughly 5-10%, depending on the platform and C compiler used.</p>
<p>From Python 3.14, when compiling extension modules for the free-threaded build of
CPython on Windows, the preprocessor variable <code class="docutils literal notranslate"><span class="pre">Py_GIL_DISABLED</span></code> now needs to
be specified by the build backend, as it will no longer be determined
automatically by the C compiler. For a running interpreter, the setting that
was used at compile time can be found using <a class="reference internal" href="../library/sysconfig.html#sysconfig.get_config_var" title="sysconfig.get_config_var"><code class="xref py py-func docutils literal notranslate"><span class="pre">sysconfig.get_config_var()</span></code></a>.</p>
<p>The new <a class="reference internal" href="../using/cmdline.html#cmdoption-X"><code class="xref std std-option docutils literal notranslate"><span class="pre">-X</span> <span class="pre">context_aware_warnings</span></code></a> flag controls if
<a class="reference internal" href="#whatsnew314-concurrent-warnings-control"><span class="std std-ref">concurrent safe warnings control</span></a>
is enabled. The flag defaults to true for the free-threaded build
and false for the GIL-enabled build.</p>
<p>A new <a class="reference internal" href="../library/sys.html#sys.flags.thread_inherit_context" title="sys.flags.thread_inherit_context"><code class="xref py py-data docutils literal notranslate"><span class="pre">thread_inherit_context</span></code></a> flag has been added,
which if enabled means that threads created with <a class="reference internal" href="../library/threading.html#threading.Thread" title="threading.Thread"><code class="xref py py-class docutils literal notranslate"><span class="pre">threading.Thread</span></code></a>
start with a copy of the <a class="reference internal" href="../library/contextvars.html#contextvars.Context" title="contextvars.Context"><code class="xref py py-class docutils literal notranslate"><span class="pre">Context()</span></code></a> of the caller of
<a class="reference internal" href="../library/threading.html#threading.Thread.start" title="threading.Thread.start"><code class="xref py py-meth docutils literal notranslate"><span class="pre">start()</span></code></a>. Most significantly, this makes the warning
filtering context established by <a class="reference internal" href="../library/warnings.html#warnings.catch_warnings" title="warnings.catch_warnings"><code class="xref py py-class docutils literal notranslate"><span class="pre">catch_warnings</span></code></a> be
“inherited” by threads (or asyncio tasks) started within that context. It also
affects other modules that use context variables, such as the <a class="reference internal" href="../library/decimal.html#module-decimal" title="decimal: Implementation of the General Decimal Arithmetic Specification."><code class="xref py py-mod docutils literal notranslate"><span class="pre">decimal</span></code></a>
context manager.
This flag defaults to true for the free-threaded build and false for
the GIL-enabled build.</p>
<p>(Contributed by Sam Gross, Matt Page, Neil Schemenauer, Thomas Wouters,
Donghee Na, Kirill Podoprigora, Ken Jin, Itamar Oren, Brett Simmers,
Dino Viehland, Nathan Goldbaum, Ralf Gommers, Lysandros Nikolaou, Kumar Aditya,
Edgar Margffoy, and many others.
Some of these contributors are employed by Meta, which has continued to provide
significant engineering resources to support this project.)</p>
</section>
<section id="improved-error-messages">
<span id="whatsnew314-improved-error-messages"></span><h3>Improved error messages<a class="headerlink" href="#improved-error-messages" title="Link to this heading">¶</a></h3>
<ul>
<li><p>The interpreter now provides helpful suggestions when it detects typos in Python
keywords. When a word that closely resembles a Python keyword is encountered,
the interpreter will suggest the correct keyword in the error message. This
feature helps programmers quickly identify and fix common typing mistakes. For
example:</p>
<div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">whille</span> <span class="kc">True</span><span class="p">:</span>
<span class="gp">... </span> <span class="k">pass</span>
<span class="gt">Traceback (most recent call last):</span>
File <span class="nb">"<stdin>"</span>, line <span class="m">1</span>
<span class="w"> </span><span class="n">whille</span> <span class="kc">True</span><span class="p">:</span>
<span class="w"> </span><span class="pm">^^^^^^</span>
<span class="gr">SyntaxError</span>: <span class="n">invalid syntax. Did you mean 'while'?</span>
</pre></div>
</div>
<p>While the feature focuses on the most common cases, some variations of
misspellings may still result in regular syntax errors.
(Contributed by Pablo Galindo in <a class="reference external" href="https://github.com/python/cpython/issues/132449">gh-132449</a>.)</p>
</li>
<li><p><a class="reference internal" href="../reference/compound_stmts.html#elif"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">elif</span></code></a> statements that follow an <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> block now have
a specific error message.
(Contributed by Steele Farnsworth in <a class="reference external" href="https://github.com/python/cpython/issues/129902">gh-129902</a>.)</p>
<div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="k">if</span> <span class="n">who</span> <span class="o">==</span> <span class="s2">"me"</span><span class="p">:</span>
<span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="s2">"It's me!"</span><span class="p">)</span>
<span class="gp">... </span><span class="k">else</span><span class="p">:</span>
<span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="s2">"It's not me!"</span><span class="p">)</span>
<span class="gp">... </span><span class="k">elif</span> <span class="n">who</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="s2">"Who is it?"</span><span class="p">)</span>
<span class="go">File "<stdin>", line 5</span>
<span class="go"> elif who is None:</span>
<span class="go"> ^^^^</span>
<span class="go">SyntaxError: 'elif' block follows an 'else' block</span>
</pre></div>
</div>
</li>
<li><p>If a statement is passed to the <a class="reference internal" href="../reference/expressions.html#if-expr"><span class="std std-ref">Conditional expressions</span></a> after <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>,
or one of <a class="reference internal" href="../reference/simple_stmts.html#pass"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">pass</span></code></a>, <a class="reference internal" href="../reference/simple_stmts.html#break"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">break</span></code></a>, or <a class="reference internal" href="../reference/simple_stmts.html#continue"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">continue</span></code></a>
is passed before <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>, then the
error message highlights where the <a class="reference internal" href="../reference/expressions.html#grammar-token-python-grammar-expression"><code class="xref std std-token docutils literal notranslate"><span class="pre">expression</span></code></a> is
required. (Contributed by Sergey Miryanov in <a class="reference external" href="https://github.com/python/cpython/issues/129515">gh-129515</a>.)</p>
<div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="mi">1</span> <span class="k">if</span> <span class="kc">True</span> <span class="k">else</span> <span class="k">pass</span>
<span class="gt">Traceback (most recent call last):</span>
File <span class="nb">"<string>"</span>, line <span class="m">1</span>
<span class="w"> </span><span class="n">x</span> <span class="o">=</span> <span class="mi">1</span> <span class="k">if</span> <span class="kc">True</span> <span class="k">else</span> <span class="k">pass</span>
<span class="w"> </span><span class="pm">^^^^</span>
<span class="gr">SyntaxError</span>: <span class="n">expected expression after 'else', but statement is given</span>
<span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="k">continue</span> <span class="k">if</span> <span class="kc">True</span> <span class="k">else</span> <span class="k">break</span>
<span class="gt">Traceback (most recent call last):</span>
File <span class="nb">"<string>"</span>, line <span class="m">1</span>
<span class="w"> </span><span class="n">x</span> <span class="o">=</span> <span class="k">continue</span> <span class="k">if</span> <span class="kc">True</span> <span class="k">else</span> <span class="k">break</span>
<span class="w"> </span><span class="pm">^^^^^^^^</span>
<span class="gr">SyntaxError</span>: <span class="n">expected expression before 'if', but statement is given</span>
</pre></div>
</div>
</li>
<li><p>When incorrectly closed strings are detected, the error message suggests
that the string may be intended to be part of the string.
(Contributed by Pablo Galindo in <a class="reference external" href="https://github.com/python/cpython/issues/88535">gh-88535</a>.)</p>
<div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="s2">"The interesting object "</span><span class="n">The</span> <span class="n">important</span> <span class="nb">object</span><span class="s2">" is very important"</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="gr">SyntaxError</span>: <span class="n">invalid syntax. Is this intended to be part of the string?</span>
</pre></div>
</div>
</li>
<li><p>When strings have incompatible prefixes, the error now shows
which prefixes are incompatible.
(Contributed by Nikita Sobolev in <a class="reference external" href="https://github.com/python/cpython/issues/133197">gh-133197</a>.)</p>
<div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">ub</span><span class="s1">'abc'</span>
File <span class="nb">"<python-input-0>"</span>, line <span class="m">1</span>
<span class="w"> </span><span class="n">ub</span><span class="s1">'abc'</span>
<span class="w"> </span><span class="pm">^^</span>
<span class="gr">SyntaxError</span>: <span class="n">'u' and 'b' prefixes are incompatible</span>
</pre></div>
</div>
</li>
<li><p>Improved error messages when using <code class="docutils literal notranslate"><span class="pre">as</span></code> with incompatible targets in:</p>
<ul class="simple">
<li><p>Imports: <code class="docutils literal notranslate"><span class="pre">import</span> <span class="pre">...</span> <span class="pre">as</span> <span class="pre">...</span></code></p></li>
<li><p>From imports: <code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">...</span> <span class="pre">import</span> <span class="pre">...</span> <span class="pre">as</span> <span class="pre">...</span></code></p></li>
<li><p>Except handlers: <code class="docutils literal notranslate"><span class="pre">except</span> <span class="pre">...</span> <span class="pre">as</span> <span class="pre">...</span></code></p></li>
<li><p>Pattern-match cases: <code class="docutils literal notranslate"><span class="pre">case</span> <span class="pre">...</span> <span class="pre">as</span> <span class="pre">...</span></code></p></li>
</ul>
<p>(Contributed by Nikita Sobolev in <a class="reference external" href="https://github.com/python/cpython/issues/123539">gh-123539</a>, <a class="reference external" href="https://github.com/python/cpython/issues/123562">gh-123562</a>, and <a class="reference external" href="https://github.com/python/cpython/issues/123440">gh-123440</a>.)</p>
</li>
<li><p>Improved error message when trying to add an instance of an unhashable type to
a <a class="reference internal" href="../library/stdtypes.html#dict" title="dict"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a> or <a class="reference internal" href="../library/stdtypes.html#set" title="set"><code class="xref py py-class docutils literal notranslate"><span class="pre">set</span></code></a>.
(Contributed by CF Bolz-Tereick and Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/132828">gh-132828</a>.)</p>
<div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">s</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">s</span><span class="o">.</span><span class="n">add</span><span class="p">({</span><span class="s1">'pages'</span><span class="p">:</span> <span class="mi">12</span><span class="p">,</span> <span class="s1">'grade'</span><span class="p">:</span> <span class="s1">'A'</span><span class="p">})</span>
<span class="gt">Traceback (most recent call last):</span>
File <span class="nb">"<python-input-1>"</span>, line <span class="m">1</span>, in <span class="n"><module></span>
<span class="w"> </span><span class="n">s</span><span class="o">.</span><span class="n">add</span><span class="p">({</span><span class="s1">'pages'</span><span class="p">:</span> <span class="mi">12</span><span class="p">,</span> <span class="s1">'grade'</span><span class="p">:</span> <span class="s1">'A'</span><span class="p">})</span>
<span class="w"> </span><span class="pm">~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</span>
<span class="gr">TypeError</span>: <span class="n">cannot use 'dict' as a set element (unhashable type: 'dict')</span>
<span class="gp">>>> </span><span class="n">d</span> <span class="o">=</span> <span class="p">{}</span>
<span class="gp">>>> </span><span class="n">l</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">]</span>
<span class="gp">>>> </span><span class="n">d</span><span class="p">[</span><span class="n">l</span><span class="p">]</span> <span class="o">=</span> <span class="mi">12</span>
<span class="gt">Traceback (most recent call last):</span>
File <span class="nb">"<python-input-4>"</span>, line <span class="m">1</span>, in <span class="n"><module></span>
<span class="w"> </span><span class="n">d</span><span class="p">[</span><span class="n">l</span><span class="p">]</span> <span class="o">=</span> <span class="mi">12</span>
<span class="w"> </span><span class="pm">~^^^</span>
<span class="gr">TypeError</span>: <span class="n">cannot use 'list' as a dict key (unhashable type: 'list')</span>
</pre></div>
</div>
</li>
<li><p>Improved error message when an object supporting the synchronous
context manager protocol is entered using <a class="reference internal" href="../reference/compound_stmts.html#async-with"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">async</span> <span class="pre">with</span></code></a>
instead of <a class="reference internal" href="../reference/compound_stmts.html#with"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">with</span></code></a>,
and vice versa for the asynchronous context manager protocol.
(Contributed by Bénédikt Tran in <a class="reference external" href="https://github.com/python/cpython/issues/128398">gh-128398</a>.)</p></li>
</ul>
</section>
<section id="pep-784-zstandard-support-in-the-standard-library">
<span id="whatsnew314-zstandard"></span><h3><span class="target" id="index-30"></span><a class="pep reference external" href="https://peps.python.org/pep-0784/"><strong>PEP 784</strong></a>: Zstandard support in the standard library<a class="headerlink" href="#pep-784-zstandard-support-in-the-standard-library" title="Link to this heading">¶</a></h3>
<p>The new <code class="xref py py-mod docutils literal notranslate"><span class="pre">compression</span></code> package contains modules <code class="xref py py-mod docutils literal notranslate"><span class="pre">compression.lzma</span></code>,
<code class="xref py py-mod docutils literal notranslate"><span class="pre">compression.bz2</span></code>, <code class="xref py py-mod docutils literal notranslate"><span class="pre">compression.gzip</span></code> and <code class="xref py py-mod docutils literal notranslate"><span class="pre">compression.zlib</span></code>
which re-export the <a class="reference internal" href="../library/lzma.html#module-lzma" title="lzma: A Python wrapper for the liblzma compression library."><code class="xref py py-mod docutils literal notranslate"><span class="pre">lzma</span></code></a>, <a class="reference internal" href="../library/bz2.html#module-bz2" title="bz2: Interfaces for bzip2 compression and decompression."><code class="xref py py-mod docutils literal notranslate"><span class="pre">bz2</span></code></a>, <a class="reference internal" href="../library/gzip.html#module-gzip" title="gzip: Interfaces for gzip compression and decompression using file objects."><code class="xref py py-mod docutils literal notranslate"><span class="pre">gzip</span></code></a> and <a class="reference internal" href="../library/zlib.html#module-zlib" title="zlib: Low-level interface to compression and decompression routines compatible with gzip."><code class="xref py py-mod docutils literal notranslate"><span class="pre">zlib</span></code></a>
modules respectively. The new import names under <code class="xref py py-mod docutils literal notranslate"><span class="pre">compression</span></code> are the
preferred names for importing these compression modules from Python 3.14. However,
the existing modules names have not been deprecated. Any deprecation or removal
of the existing compression modules will occur no sooner than five years after
the release of 3.14.</p>
<p>The new <code class="xref py py-mod docutils literal notranslate"><span class="pre">compression.zstd</span></code> module provides compression and decompression
APIs for the Zstandard format via bindings to <a class="reference external" href="https://facebook.github.io/zstd/">Meta’s zstd library</a>. Zstandard is a widely adopted, highly
efficient, and fast compression format. In addition to the APIs introduced in
<code class="xref py py-mod docutils literal notranslate"><span class="pre">compression.zstd</span></code>, support for reading and writing Zstandard compressed
archives has been added to the <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>, <a class="reference internal" href="../library/zipfile.html#module-zipfile" title="zipfile: Read and write ZIP-format archive files."><code class="xref py py-mod docutils literal notranslate"><span class="pre">zipfile</span></code></a>, and
<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> modules.</p>
<p>Here’s an example of using the new module to compress some data:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">compression</span><span class="w"> </span><span class="kn">import</span> <span class="n">zstd</span>
<span class="kn">import</span><span class="w"> </span><span class="nn">math</span>
<span class="n">data</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">pi</span><span class="p">)</span><span class="o">.</span><span class="n">encode</span><span class="p">()</span> <span class="o">*</span> <span class="mi">20</span>
<span class="n">compressed</span> <span class="o">=</span> <span class="n">zstd</span><span class="o">.</span><span class="n">compress</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="n">ratio</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">compressed</span><span class="p">)</span> <span class="o">/</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Achieved compression ratio of </span><span class="si">{</span><span class="n">ratio</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span>
</pre></div>
</div>
<p>As can be seen, the API is similar to the APIs of the <code class="xref py py-mod docutils literal notranslate"><span class="pre">lzma</span></code> and
<code class="xref py py-mod docutils literal notranslate"><span class="pre">bz2</span></code> modules.</p>
<p>(Contributed by Emma Harper Smith, Adam Turner, Gregory P. Smith, Tomas Roun,
Victor Stinner, and Rogdham in <a class="reference external" href="https://github.com/python/cpython/issues/132983">gh-132983</a>.)</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><span class="target" id="index-31"></span><a class="pep reference external" href="https://peps.python.org/pep-0784/"><strong>PEP 784</strong></a>.</p>
</div>
</section>
<section id="asyncio-introspection-capabilities">
<span id="whatsnew314-asyncio-introspection"></span><h3>Asyncio introspection capabilities<a class="headerlink" href="#asyncio-introspection-capabilities" title="Link to this heading">¶</a></h3>
<p>Added a new command-line interface to inspect running Python processes
using asynchronous tasks, available via <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">asyncio</span> <span class="pre">ps</span> <span class="pre">PID</span></code>
or <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">asyncio</span> <span class="pre">pstree</span> <span class="pre">PID</span></code>.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">ps</span></code> subcommand inspects the given process ID (PID) and displays
information about currently running asyncio tasks.
It outputs a task table: a flat listing of all tasks, their names,
their coroutine stacks, and which tasks are awaiting them.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">pstree</span></code> subcommand fetches the same information, but instead renders a
visual async call tree, showing coroutine relationships in a hierarchical format.
This command is particularly useful for debugging long-running or stuck
asynchronous programs.
It can help developers quickly identify where a program is blocked,
what tasks are pending, and how coroutines are chained together.</p>
<p>For example given this code:</p>
<div class="highlight-python 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">play_track</span><span class="p">(</span><span class="n">track</span><span class="p">):</span>
<span class="k">await</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s1">'🎵 Finished: </span><span class="si">{</span><span class="n">track</span><span class="si">}</span><span class="s1">'</span><span class="p">)</span>
<span class="k">async</span> <span class="k">def</span><span class="w"> </span><span class="nf">play_album</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">tracks</span><span class="p">):</span>
<span class="k">async</span> <span class="k">with</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">TaskGroup</span><span class="p">()</span> <span class="k">as</span> <span class="n">tg</span><span class="p">:</span>
<span class="k">for</span> <span class="n">track</span> <span class="ow">in</span> <span class="n">tracks</span><span class="p">:</span>
<span class="n">tg</span><span class="o">.</span><span class="n">create_task</span><span class="p">(</span><span class="n">play_track</span><span class="p">(</span><span class="n">track</span><span class="p">),</span> <span class="n">name</span><span class="o">=</span><span class="n">track</span><span class="p">)</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="k">async</span> <span class="k">with</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">TaskGroup</span><span class="p">()</span> <span class="k">as</span> <span class="n">tg</span><span class="p">:</span>
<span class="n">tg</span><span class="o">.</span><span class="n">create_task</span><span class="p">(</span>
<span class="n">play_album</span><span class="p">(</span><span class="s1">'Sundowning'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'TNDNBTG'</span><span class="p">,</span> <span class="s1">'Levitate'</span><span class="p">]),</span>
<span class="n">name</span><span class="o">=</span><span class="s1">'Sundowning'</span><span class="p">)</span>
<span class="n">tg</span><span class="o">.</span><span class="n">create_task</span><span class="p">(</span>
<span class="n">play_album</span><span class="p">(</span><span class="s1">'TMBTE'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'DYWTYLM'</span><span class="p">,</span> <span class="s1">'Aqua Regia'</span><span class="p">]),</span>
<span class="n">name</span><span class="o">=</span><span class="s1">'TMBTE'</span><span class="p">)</span>
<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s1">'__main__'</span><span class="p">:</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>
</pre></div>
</div>
<p>Executing the new tool on the running process will yield a table like this:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python<span class="w"> </span>-m<span class="w"> </span>asyncio<span class="w"> </span>ps<span class="w"> </span><span class="m">12345</span>
tid<span class="w"> </span>task<span class="w"> </span>id<span class="w"> </span>task<span class="w"> </span>name<span class="w"> </span>coroutine<span class="w"> </span>stack<span class="w"> </span>awaiter<span class="w"> </span>chain<span class="w"> </span>awaiter<span class="w"> </span>name<span class="w"> </span>awaiter<span class="w"> </span>id
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<span class="m">1935500</span><span class="w"> </span>0x7fc930c18050<span class="w"> </span>Task-1<span class="w"> </span>TaskGroup._aexit<span class="w"> </span>-><span class="w"> </span>TaskGroup.__aexit__<span class="w"> </span>-><span class="w"> </span>main<span class="w"> </span>0x0
<span class="m">1935500</span><span class="w"> </span>0x7fc930c18230<span class="w"> </span>Sundowning<span class="w"> </span>TaskGroup._aexit<span class="w"> </span>-><span class="w"> </span>TaskGroup.__aexit__<span class="w"> </span>-><span class="w"> </span>album<span class="w"> </span>TaskGroup._aexit<span class="w"> </span>-><span class="w"> </span>TaskGroup.__aexit__<span class="w"> </span>-><span class="w"> </span>main<span class="w"> </span>Task-1<span class="w"> </span>0x7fc930c18050
<span class="m">1935500</span><span class="w"> </span>0x7fc93173fa50<span class="w"> </span>TMBTE<span class="w"> </span>TaskGroup._aexit<span class="w"> </span>-><span class="w"> </span>TaskGroup.__aexit__<span class="w"> </span>-><span class="w"> </span>album<span class="w"> </span>TaskGroup._aexit<span class="w"> </span>-><span class="w"> </span>TaskGroup.__aexit__<span class="w"> </span>-><span class="w"> </span>main<span class="w"> </span>Task-1<span class="w"> </span>0x7fc930c18050
<span class="m">1935500</span><span class="w"> </span>0x7fc93173fdf0<span class="w"> </span>TNDNBTG<span class="w"> </span>sleep<span class="w"> </span>-><span class="w"> </span>play<span class="w"> </span>TaskGroup._aexit<span class="w"> </span>-><span class="w"> </span>TaskGroup.__aexit__<span class="w"> </span>-><span class="w"> </span>album<span class="w"> </span>Sundowning<span class="w"> </span>0x7fc930c18230
<span class="m">1935500</span><span class="w"> </span>0x7fc930d32510<span class="w"> </span>Levitate<span class="w"> </span>sleep<span class="w"> </span>-><span class="w"> </span>play<span class="w"> </span>TaskGroup._aexit<span class="w"> </span>-><span class="w"> </span>TaskGroup.__aexit__<span class="w"> </span>-><span class="w"> </span>album<span class="w"> </span>Sundowning<span class="w"> </span>0x7fc930c18230
<span class="m">1935500</span><span class="w"> </span>0x7fc930d32890<span class="w"> </span>DYWTYLM<span class="w"> </span>sleep<span class="w"> </span>-><span class="w"> </span>play<span class="w"> </span>TaskGroup._aexit<span class="w"> </span>-><span class="w"> </span>TaskGroup.__aexit__<span class="w"> </span>-><span class="w"> </span>album<span class="w"> </span>TMBTE<span class="w"> </span>0x7fc93173fa50
<span class="m">1935500</span><span class="w"> </span>0x7fc93161ec30<span class="w"> </span>Aqua<span class="w"> </span>Regia<span class="w"> </span>sleep<span class="w"> </span>-><span class="w"> </span>play<span class="w"> </span>TaskGroup._aexit<span class="w"> </span>-><span class="w"> </span>TaskGroup.__aexit__<span class="w"> </span>-><span class="w"> </span>album<span class="w"> </span>TMBTE<span class="w"> </span>0x7fc93173fa50
</pre></div>
</div>
<p>or a tree like this:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python<span class="w"> </span>-m<span class="w"> </span>asyncio<span class="w"> </span>pstree<span class="w"> </span><span class="m">12345</span>
└──<span class="w"> </span><span class="o">(</span>T<span class="o">)</span><span class="w"> </span>Task-1
<span class="w"> </span>└──<span class="w"> </span>main<span class="w"> </span>example.py:13
<span class="w"> </span>└──<span class="w"> </span>TaskGroup.__aexit__<span class="w"> </span>Lib/asyncio/taskgroups.py:72
<span class="w"> </span>└──<span class="w"> </span>TaskGroup._aexit<span class="w"> </span>Lib/asyncio/taskgroups.py:121
<span class="w"> </span>├──<span class="w"> </span><span class="o">(</span>T<span class="o">)</span><span class="w"> </span>Sundowning
<span class="w"> </span>│<span class="w"> </span>└──<span class="w"> </span>album<span class="w"> </span>example.py:8
<span class="w"> </span>│<span class="w"> </span>└──<span class="w"> </span>TaskGroup.__aexit__<span class="w"> </span>Lib/asyncio/taskgroups.py:72
<span class="w"> </span>│<span class="w"> </span>└──<span class="w"> </span>TaskGroup._aexit<span class="w"> </span>Lib/asyncio/taskgroups.py:121
<span class="w"> </span>│<span class="w"> </span>├──<span class="w"> </span><span class="o">(</span>T<span class="o">)</span><span class="w"> </span>TNDNBTG
<span class="w"> </span>│<span class="w"> </span>│<span class="w"> </span>└──<span class="w"> </span>play<span class="w"> </span>example.py:4
<span class="w"> </span>│<span class="w"> </span>│<span class="w"> </span>└──<span class="w"> </span>sleep<span class="w"> </span>Lib/asyncio/tasks.py:702
<span class="w"> </span>│<span class="w"> </span>└──<span class="w"> </span><span class="o">(</span>T<span class="o">)</span><span class="w"> </span>Levitate
<span class="w"> </span>│<span class="w"> </span>└──<span class="w"> </span>play<span class="w"> </span>example.py:4
<span class="w"> </span>│<span class="w"> </span>└──<span class="w"> </span>sleep<span class="w"> </span>Lib/asyncio/tasks.py:702
<span class="w"> </span>└──<span class="w"> </span><span class="o">(</span>T<span class="o">)</span><span class="w"> </span>TMBTE
<span class="w"> </span>└──<span class="w"> </span>album<span class="w"> </span>example.py:8
<span class="w"> </span>└──<span class="w"> </span>TaskGroup.__aexit__<span class="w"> </span>Lib/asyncio/taskgroups.py:72
<span class="w"> </span>└──<span class="w"> </span>TaskGroup._aexit<span class="w"> </span>Lib/asyncio/taskgroups.py:121
<span class="w"> </span>├──<span class="w"> </span><span class="o">(</span>T<span class="o">)</span><span class="w"> </span>DYWTYLM
<span class="w"> </span>│<span class="w"> </span>└──<span class="w"> </span>play<span class="w"> </span>example.py:4
<span class="w"> </span>│<span class="w"> </span>└──<span class="w"> </span>sleep<span class="w"> </span>Lib/asyncio/tasks.py:702
<span class="w"> </span>└──<span class="w"> </span><span class="o">(</span>T<span class="o">)</span><span class="w"> </span>Aqua<span class="w"> </span>Regia
<span class="w"> </span>└──<span class="w"> </span>play<span class="w"> </span>example.py:4
<span class="w"> </span>└──<span class="w"> </span>sleep<span class="w"> </span>Lib/asyncio/tasks.py:702
</pre></div>
</div>
<p>If a cycle is detected in the async await graph (which could indicate a
programming issue), the tool raises an error and lists the cycle paths that
prevent tree construction:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python<span class="w"> </span>-m<span class="w"> </span>asyncio<span class="w"> </span>pstree<span class="w"> </span><span class="m">12345</span>
ERROR:<span class="w"> </span>await-graph<span class="w"> </span>contains<span class="w"> </span>cycles<span class="w"> </span>-<span class="w"> </span>cannot<span class="w"> </span>print<span class="w"> </span>a<span class="w"> </span>tree!
cycle:<span class="w"> </span>Task-2<span class="w"> </span>→<span class="w"> </span>Task-3<span class="w"> </span>→<span class="w"> </span>Task-2
</pre></div>
</div>
<p>(Contributed by Pablo Galindo, Łukasz Langa, Yury Selivanov, and Marta
Gomez Macias in <a class="reference external" href="https://github.com/python/cpython/issues/91048">gh-91048</a>.)</p>
</section>
<section id="concurrent-safe-warnings-control">
<span id="whatsnew314-concurrent-warnings-control"></span><h3>Concurrent safe warnings control<a class="headerlink" href="#concurrent-safe-warnings-control" title="Link to this heading">¶</a></h3>
<p>The <a class="reference internal" href="../library/warnings.html#warnings.catch_warnings" title="warnings.catch_warnings"><code class="xref py py-class docutils literal notranslate"><span class="pre">warnings.catch_warnings</span></code></a> context manager will now optionally
use a context variable for warning filters. This is enabled by setting
the <a class="reference internal" href="../library/sys.html#sys.flags.context_aware_warnings" title="sys.flags.context_aware_warnings"><code class="xref py py-data docutils literal notranslate"><span class="pre">context_aware_warnings</span></code></a> flag, either with the <code class="docutils literal notranslate"><span class="pre">-X</span></code>
command-line option or an environment variable. This gives predictable
warnings control when using <a class="reference internal" href="../library/warnings.html#warnings.catch_warnings" title="warnings.catch_warnings"><code class="xref py py-class docutils literal notranslate"><span class="pre">catch_warnings</span></code></a> combined with
multiple threads or asynchronous tasks. The flag defaults to true for the
free-threaded build and false for the GIL-enabled build.</p>
<p>(Contributed by Neil Schemenauer and Kumar Aditya in <a class="reference external" href="https://github.com/python/cpython/issues/130010">gh-130010</a>.)</p>
</section>
</section>
<section id="other-language-changes">
<h2>Other language changes<a class="headerlink" href="#other-language-changes" title="Link to this heading">¶</a></h2>
<ul class="simple">
<li><p>All Windows code pages are now supported as ‘cpXXX’ codecs on Windows.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/123803">gh-123803</a>.)</p></li>
<li><p>Implement mixed-mode arithmetic rules combining real and complex numbers
as specified by the C standard since C99.
(Contributed by Sergey B Kirpichev in <a class="reference external" href="https://github.com/python/cpython/issues/69639">gh-69639</a>.)</p></li>
<li><p>More syntax errors are now detected regardless of optimisation and
the <a class="reference internal" href="../using/cmdline.html#cmdoption-O"><code class="xref std std-option docutils literal notranslate"><span class="pre">-O</span></code></a> command-line option.
This includes writes to <code class="docutils literal notranslate"><span class="pre">__debug__</span></code>, incorrect use of <a class="reference internal" href="../reference/expressions.html#await"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">await</span></code></a>,
and asynchronous comprehensions outside asynchronous functions.
For example, <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-O</span> <span class="pre">-c</span> <span class="pre">'assert</span> <span class="pre">(__debug__</span> <span class="pre">:=</span> <span class="pre">1)'</span></code>
or <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-O</span> <span class="pre">-c</span> <span class="pre">'assert</span> <span class="pre">await</span> <span class="pre">1'</span></code> now produce <a class="reference internal" href="../library/exceptions.html#SyntaxError" title="SyntaxError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">SyntaxError</span></code></a>s.
(Contributed by Irit Katriel and Jelle Zijlstra in <a class="reference external" href="https://github.com/python/cpython/issues/122245">gh-122245</a> & <a class="reference external" href="https://github.com/python/cpython/issues/121637">gh-121637</a>.)</p></li>
<li><p>When subclassing a pure C type, the C slots for the new type
are no longer replaced with a wrapped version on class creation
if they are not explicitly overridden in the subclass.
(Contributed by Tomasz Pytel in <a class="reference external" href="https://github.com/python/cpython/issues/132284">gh-132284</a>.)</p></li>
</ul>
<section id="built-ins">
<h3>Built-ins<a class="headerlink" href="#built-ins" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>The <a class="reference internal" href="../library/stdtypes.html#bytes.fromhex" title="bytes.fromhex"><code class="xref py py-meth docutils literal notranslate"><span class="pre">bytes.fromhex()</span></code></a> and <a class="reference internal" href="../library/stdtypes.html#bytearray.fromhex" title="bytearray.fromhex"><code class="xref py py-meth docutils literal notranslate"><span class="pre">bytearray.fromhex()</span></code></a> methods now accept
ASCII <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="../glossary.html#term-bytes-like-object"><span class="xref std std-term">bytes-like objects</span></a>.
(Contributed by Daniel Pope in <a class="reference external" href="https://github.com/python/cpython/issues/129349">gh-129349</a>.)</p></li>
<li><p>Add class methods <a class="reference internal" href="../library/stdtypes.html#float.from_number" title="float.from_number"><code class="xref py py-meth docutils literal notranslate"><span class="pre">float.from_number()</span></code></a> and <a class="reference internal" href="../library/stdtypes.html#complex.from_number" title="complex.from_number"><code class="xref py py-meth docutils literal notranslate"><span class="pre">complex.from_number()</span></code></a>
to convert a number to <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> or <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> type correspondingly.
They raise a <a class="reference internal" href="../library/exceptions.html#TypeError" title="TypeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code></a> if the argument is not a real number.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/84978">gh-84978</a>.)</p></li>
<li><p>Support underscore and comma as thousands separators in the fractional part
for floating-point presentation types of the new-style string formatting
(with <a class="reference internal" href="../library/functions.html#format" title="format"><code class="xref py py-func docutils literal notranslate"><span class="pre">format()</span></code></a> or <a class="reference internal" href="../reference/lexical_analysis.html#f-strings"><span class="std std-ref">f-strings</span></a>).
(Contributed by Sergey B Kirpichev in <a class="reference external" href="https://github.com/python/cpython/issues/87790">gh-87790</a>.)</p></li>
<li><p>The <a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-func docutils literal notranslate"><span class="pre">int()</span></code></a> function no longer delegates to <a class="reference internal" href="../reference/datamodel.html#object.__trunc__" title="object.__trunc__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__trunc__()</span></code></a>.
Classes that want to support conversion to <code class="xref py py-func docutils literal notranslate"><span class="pre">int()</span></code> must implement
either <a class="reference internal" href="../reference/datamodel.html#object.__int__" title="object.__int__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__int__()</span></code></a> or <a class="reference internal" href="../reference/datamodel.html#object.__index__" title="object.__index__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__index__()</span></code></a>.
(Contributed by Mark Dickinson in <a class="reference external" href="https://github.com/python/cpython/issues/119743">gh-119743</a>.)</p></li>
<li><p>The <a class="reference internal" href="../library/functions.html#map" title="map"><code class="xref py py-func docutils literal notranslate"><span class="pre">map()</span></code></a> function now has an optional keyword-only <em>strict</em> flag
like <a class="reference internal" href="../library/functions.html#zip" title="zip"><code class="xref py py-func docutils literal notranslate"><span class="pre">zip()</span></code></a> to check that all the iterables are of equal length.
(Contributed by Wannes Boeykens in <a class="reference external" href="https://github.com/python/cpython/issues/119793">gh-119793</a>.)</p></li>
<li><p>The <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> type now supports subscription,
making it a <a class="reference internal" href="../glossary.html#term-generic-type"><span class="xref std std-term">generic type</span></a>.
(Contributed by Brian Schubert in <a class="reference external" href="https://github.com/python/cpython/issues/126012">gh-126012</a>.)</p></li>
<li><p>Using <a class="reference internal" href="../library/constants.html#NotImplemented" title="NotImplemented"><code class="xref py py-data docutils literal notranslate"><span class="pre">NotImplemented</span></code></a> in a boolean context
will now raise a <a class="reference internal" href="../library/exceptions.html#TypeError" title="TypeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code></a>.
This has raised a <a class="reference internal" href="../library/exceptions.html#DeprecationWarning" title="DeprecationWarning"><code class="xref py py-exc docutils literal notranslate"><span class="pre">DeprecationWarning</span></code></a> since Python 3.9.
(Contributed by Jelle Zijlstra in <a class="reference external" href="https://github.com/python/cpython/issues/118767">gh-118767</a>.)</p></li>
<li><p>Three-argument <a class="reference internal" href="../library/functions.html#pow" title="pow"><code class="xref py py-func docutils literal notranslate"><span class="pre">pow()</span></code></a> now tries calling <a class="reference internal" href="../reference/datamodel.html#object.__rpow__" title="object.__rpow__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__rpow__()</span></code></a>
if necessary.
Previously it was only called in two-argument <code class="xref py py-func docutils literal notranslate"><span class="pre">pow()</span></code>
and the binary power operator.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/130104">gh-130104</a>.)</p></li>
<li><p><a class="reference internal" href="../library/functions.html#super" title="super"><code class="xref py py-class docutils literal notranslate"><span class="pre">super</span></code></a> objects are now <a class="reference internal" href="../library/copy.html#module-copy" title="copy: Shallow and deep copy operations."><code class="xref py py-mod docutils literal notranslate"><span class="pre">copyable</span></code></a> and <a class="reference internal" href="../library/pickle.html#module-pickle" title="pickle: Convert Python objects to streams of bytes and back."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pickleable</span></code></a>.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/125767">gh-125767</a>.)</p></li>
</ul>
</section>
<section id="command-line-and-environment">
<h3>Command line and environment<a class="headerlink" href="#command-line-and-environment" title="Link to this heading">¶</a></h3>
<ul>
<li><p>The import time flag can now track modules that are already loaded (‘cached’),
via the new <a class="reference internal" href="../using/cmdline.html#cmdoption-X"><code class="xref std std-option docutils literal notranslate"><span class="pre">-X</span> <span class="pre">importtime=2</span></code></a>.
When such a module is imported, the <code class="docutils literal notranslate"><span class="pre">self</span></code> and <code class="docutils literal notranslate"><span class="pre">cumulative</span></code> times
are replaced by the string <code class="docutils literal notranslate"><span class="pre">cached</span></code>.</p>
<p>Values above <code class="docutils literal notranslate"><span class="pre">2</span></code> for <code class="docutils literal notranslate"><span class="pre">-X</span> <span class="pre">importtime</span></code> are now reserved for future use.</p>
<p>(Contributed by Noah Kim and Adam Turner in <a class="reference external" href="https://github.com/python/cpython/issues/118655">gh-118655</a>.)</p>
</li>
<li><p>The command-line option <a class="reference internal" href="../using/cmdline.html#cmdoption-c"><code class="xref std std-option docutils literal notranslate"><span class="pre">-c</span></code></a> now automatically dedents its code
argument before execution. The auto-dedentation behavior mirrors
<a class="reference internal" href="../library/textwrap.html#textwrap.dedent" title="textwrap.dedent"><code class="xref py py-func docutils literal notranslate"><span class="pre">textwrap.dedent()</span></code></a>.
(Contributed by Jon Crall and Steven Sun in <a class="reference external" href="https://github.com/python/cpython/issues/103998">gh-103998</a>.)</p></li>
<li><p><code class="xref std std-option docutils literal notranslate"><span class="pre">-J</span></code> is no longer a reserved flag for <a class="reference external" href="https://www.jython.org/">Jython</a>,
and now has no special meaning.
(Contributed by Adam Turner in <a class="reference external" href="https://github.com/python/cpython/issues/133336">gh-133336</a>.)</p>
</li>
</ul>
</section>
<section id="pep-758-allow-except-and-except-expressions-without-brackets">
<span id="whatsnew314-bracketless-except"></span><h3>PEP 758: Allow <code class="docutils literal notranslate"><span class="pre">except</span></code> and <code class="docutils literal notranslate"><span class="pre">except*</span></code> expressions without brackets<a class="headerlink" href="#pep-758-allow-except-and-except-expressions-without-brackets" title="Link to this heading">¶</a></h3>
<p>The <a class="reference internal" href="../reference/compound_stmts.html#except"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">except</span></code></a> and <a class="reference internal" href="../reference/compound_stmts.html#except-star"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">except*</span></code></a> expressions
now allow brackets to be omitted when there are multiple exception types
and the <code class="docutils literal notranslate"><span class="pre">as</span></code> clause is not used.
For example:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">try</span><span class="p">:</span>
<span class="n">connect_to_server</span><span class="p">()</span>
<span class="k">except</span> <span class="ne">TimeoutError</span><span class="p">,</span> <span class="ne">ConnectionRefusedError</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">'The network has ceased to be!'</span><span class="p">)</span>
</pre></div>
</div>
<p>(Contributed by Pablo Galindo and Brett Cannon in <span class="target" id="index-32"></span><a class="pep reference external" href="https://peps.python.org/pep-0758/"><strong>PEP 758</strong></a> and <a class="reference external" href="https://github.com/python/cpython/issues/131831">gh-131831</a>.)</p>
</section>
<section id="pep-765-control-flow-in-finally-blocks">
<span id="whatsnew314-finally-syntaxwarning"></span><h3>PEP 765: Control flow in <a class="reference internal" href="../reference/compound_stmts.html#finally"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">finally</span></code></a> blocks<a class="headerlink" href="#pep-765-control-flow-in-finally-blocks" title="Link to this heading">¶</a></h3>
<p>The compiler now emits a <a class="reference internal" href="../library/exceptions.html#SyntaxWarning" title="SyntaxWarning"><code class="xref py py-exc docutils literal notranslate"><span class="pre">SyntaxWarning</span></code></a> when a <a class="reference internal" href="../reference/simple_stmts.html#return"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">return</span></code></a>,
<a class="reference internal" href="../reference/simple_stmts.html#break"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">break</span></code></a>, or <a class="reference internal" href="../reference/simple_stmts.html#continue"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">continue</span></code></a> statement have the effect of
leaving a <a class="reference internal" href="../reference/compound_stmts.html#finally"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">finally</span></code></a> block.
This change is specified in <span class="target" id="index-33"></span><a class="pep reference external" href="https://peps.python.org/pep-0765/"><strong>PEP 765</strong></a>.</p>
<p>In situations where this change is inconvenient (such as those where the
warnings are redundant due to code linting), the <a class="reference internal" href="../library/warnings.html#warning-filter"><span class="std std-ref">warning filter</span></a> can be used to turn off all syntax warnings by adding
<code class="docutils literal notranslate"><span class="pre">ignore::SyntaxWarning</span></code> as a filter. This can be specified in combination
with a filter that converts other warnings to errors (for example, passing
<code class="docutils literal notranslate"><span class="pre">-Werror</span> <span class="pre">-Wignore::SyntaxWarning</span></code> as CLI options, or setting
<code class="docutils literal notranslate"><span class="pre">PYTHONWARNINGS=error,ignore::SyntaxWarning</span></code>).</p>
<p>Note that applying such a filter at runtime using the <a class="reference internal" href="../library/warnings.html#module-warnings" title="warnings: Issue warning messages and control their disposition."><code class="xref py py-mod docutils literal notranslate"><span class="pre">warnings</span></code></a> module
will only suppress the warning in code that is compiled <em>after</em> the filter is
adjusted. Code that is compiled prior to the filter adjustment (for example,
when a module is imported) will still emit the syntax warning.</p>
<p>(Contributed by Irit Katriel in <a class="reference external" href="https://github.com/python/cpython/issues/130080">gh-130080</a>.)</p>
</section>
<section id="incremental-garbage-collection">
<span id="whatsnew314-incremental-gc"></span><h3>Incremental garbage collection<a class="headerlink" href="#incremental-garbage-collection" title="Link to this heading">¶</a></h3>
<p>The cycle garbage collector is now incremental.
This means that maximum pause times are reduced
by an order of magnitude or more for larger heaps.</p>
<p>There are now only two generations: young and old.
When <a class="reference internal" href="../library/gc.html#gc.collect" title="gc.collect"><code class="xref py py-func docutils literal notranslate"><span class="pre">gc.collect()</span></code></a> is not called directly, the
GC is invoked a little less frequently. When invoked, it
collects the young generation and an increment of the
old generation, instead of collecting one or more generations.</p>
<p>The behavior of <code class="xref py py-func docutils literal notranslate"><span class="pre">gc.collect()</span></code> changes slightly:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">gc.collect(1)</span></code>: Performs an increment of garbage collection,
rather than collecting generation 1.</p></li>
<li><p>Other calls to <code class="xref py py-func docutils literal notranslate"><span class="pre">gc.collect()</span></code> are unchanged.</p></li>
</ul>
<p>(Contributed by Mark Shannon in <a class="reference external" href="https://github.com/python/cpython/issues/108362">gh-108362</a>.)</p>
</section>
<section id="default-interactive-shell">
<h3>Default interactive shell<a class="headerlink" href="#default-interactive-shell" title="Link to this heading">¶</a></h3>
<ul id="whatsnew314-pyrepl-highlighting">
<li><p>The default <a class="reference internal" href="../glossary.html#term-interactive"><span class="xref std std-term">interactive</span></a> shell now highlights Python syntax.
The feature is enabled by default, save if <span class="target" id="index-34"></span><a class="reference internal" href="../using/cmdline.html#envvar-PYTHON_BASIC_REPL"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHON_BASIC_REPL</span></code></a>
or any other environment variable that disables colour is set.
See <a class="reference internal" href="../using/cmdline.html#using-on-controlling-color"><span class="std std-ref">Controlling color</span></a> for details.</p>
<p>The default color theme for syntax highlighting strives for good contrast
and exclusively uses the 4-bit VGA standard ANSI color codes for maximum
compatibility. The theme can be customized using an experimental API
<code class="xref py py-func docutils literal notranslate"><span class="pre">_colorize.set_theme()</span></code>.
This can be called interactively or in the <span class="target" id="index-35"></span><a class="reference internal" href="../using/cmdline.html#envvar-PYTHONSTARTUP"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONSTARTUP</span></code></a> script.
Note that this function has no stability guarantees,
and may change or be removed.</p>
<p>(Contributed by Łukasz Langa in <a class="reference external" href="https://github.com/python/cpython/issues/131507">gh-131507</a>.)</p>
</li>
<li><p>The default <a class="reference internal" href="../glossary.html#term-interactive"><span class="xref std std-term">interactive</span></a> shell now supports import auto-completion.
This means that typing <code class="docutils literal notranslate"><span class="pre">import</span> <span class="pre">co</span></code> and pressing <kbd class="kbd docutils literal notranslate"><Tab></kbd> will suggest
modules starting with <code class="docutils literal notranslate"><span class="pre">co</span></code>. Similarly, typing <code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">concurrent</span> <span class="pre">import</span> <span class="pre">i</span></code>
will suggest submodules of <code class="docutils literal notranslate"><span class="pre">concurrent</span></code> starting with <code class="docutils literal notranslate"><span class="pre">i</span></code>.
Note that autocompletion of module attributes is not currently supported.
(Contributed by Tomas Roun in <a class="reference external" href="https://github.com/python/cpython/issues/69605">gh-69605</a>.)</p></li>
</ul>
</section>
</section>
<section id="new-modules">
<h2>New modules<a class="headerlink" href="#new-modules" title="Link to this heading">¶</a></h2>
<ul class="simple">
<li><p><a class="reference internal" href="../library/annotationlib.html#module-annotationlib" title="annotationlib: Functionality for introspecting annotations"><code class="xref py py-mod docutils literal notranslate"><span class="pre">annotationlib</span></code></a>:
For introspecting <a class="reference internal" href="../glossary.html#term-annotation"><span class="xref std std-term">annotations</span></a>.
See <a class="reference internal" href="#whatsnew314-deferred-annotations"><span class="std std-ref">PEP 749</span></a> for more details.
(Contributed by Jelle Zijlstra in <a class="reference external" href="https://github.com/python/cpython/issues/119180">gh-119180</a>.)</p></li>
<li><p><a class="reference internal" href="../library/compression.html#module-compression" title="compression"><code class="xref py py-mod docutils literal notranslate"><span class="pre">compression</span></code></a> (including <a class="reference internal" href="../library/compression.zstd.html#module-compression.zstd" title="compression.zstd: Low-level interface to compression and decompression routines in the zstd library."><code class="xref py py-mod docutils literal notranslate"><span class="pre">compression.zstd</span></code></a>):
A package for compression-related modules,
including a new module to support the Zstandard compression format.
See <a class="reference internal" href="#whatsnew314-zstandard"><span class="std std-ref">PEP 784</span></a> for more details.
(Contributed by Emma Harper Smith, Adam Turner, Gregory P. Smith, Tomas Roun,
Victor Stinner, and Rogdham in <a class="reference external" href="https://github.com/python/cpython/issues/132983">gh-132983</a>.)</p></li>
<li><p><a class="reference internal" href="../library/concurrent.interpreters.html#module-concurrent.interpreters" title="concurrent.interpreters: Multiple interpreters in the same process"><code class="xref py py-mod docutils literal notranslate"><span class="pre">concurrent.interpreters</span></code></a>:
Support for multiple interpreters in the standard library.
See <a class="reference internal" href="#whatsnew314-multiple-interpreters"><span class="std std-ref">PEP 734</span></a> for more details.
(Contributed by Eric Snow in <a class="reference external" href="https://github.com/python/cpython/issues/134939">gh-134939</a>.)</p></li>
<li><p><a class="reference internal" href="../library/string.templatelib.html#module-string.templatelib" title="string.templatelib: Support for template string literals."><code class="xref py py-mod docutils literal notranslate"><span class="pre">string.templatelib</span></code></a>:
Support for template string literals (t-strings).
See <a class="reference internal" href="#whatsnew314-template-string-literals"><span class="std std-ref">PEP 750</span></a> for more details.
(Contributed by Jim Baker, Guido van Rossum, Paul Everitt, Koudai Aono,
Lysandros Nikolaou, Dave Peck, Adam Turner, Jelle Zijlstra, Bénédikt Tran,
and Pablo Galindo Salgado in <a class="reference external" href="https://github.com/python/cpython/issues/132661">gh-132661</a>.)</p></li>
</ul>
</section>
<section id="improved-modules">
<h2>Improved modules<a class="headerlink" href="#improved-modules" title="Link to this heading">¶</a></h2>
<section id="argparse">
<h3>argparse<a class="headerlink" href="#argparse" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>The default value of the <a class="reference internal" href="../library/argparse.html#prog"><span class="std std-ref">program name</span></a> for
<a class="reference internal" href="../library/argparse.html#argparse.ArgumentParser" title="argparse.ArgumentParser"><code class="xref py py-class docutils literal notranslate"><span class="pre">argparse.ArgumentParser</span></code></a> now reflects the way the Python
interpreter was instructed to find the <code class="docutils literal notranslate"><span class="pre">__main__</span></code> module code.
(Contributed by Serhiy Storchaka and Alyssa Coghlan in <a class="reference external" href="https://github.com/python/cpython/issues/66436">gh-66436</a>.)</p></li>
<li><p>Introduced the optional <em>suggest_on_error</em> parameter to
<a class="reference internal" href="../library/argparse.html#argparse.ArgumentParser" title="argparse.ArgumentParser"><code class="xref py py-class docutils literal notranslate"><span class="pre">argparse.ArgumentParser</span></code></a>, enabling suggestions for argument choices
and subparser names if mistyped by the user.
(Contributed by Savannah Ostrowski in <a class="reference external" href="https://github.com/python/cpython/issues/124456">gh-124456</a>.)</p></li>
<li><p>Enable color for help text, which can be disabled with the optional <em>color</em>
parameter to <a class="reference internal" href="../library/argparse.html#argparse.ArgumentParser" title="argparse.ArgumentParser"><code class="xref py py-class docutils literal notranslate"><span class="pre">argparse.ArgumentParser</span></code></a>.
This can also be controlled by <a class="reference internal" href="../using/cmdline.html#using-on-controlling-color"><span class="std std-ref">environment variables</span></a>.
(Contributed by Hugo van Kemenade in <a class="reference external" href="https://github.com/python/cpython/issues/130645">gh-130645</a>.)</p></li>
</ul>
</section>
<section id="ast">
<h3>ast<a class="headerlink" href="#ast" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add <a class="reference internal" href="../library/ast.html#ast.compare" title="ast.compare"><code class="xref py py-func docutils literal notranslate"><span class="pre">compare()</span></code></a>, a function for comparing two ASTs.
(Contributed by Batuhan Taskaya and Jeremy Hylton in <a class="reference external" href="https://github.com/python/cpython/issues/60191">gh-60191</a>.)</p></li>
<li><p>Add support for <a class="reference internal" href="../library/copy.html#copy.replace" title="copy.replace"><code class="xref py py-func docutils literal notranslate"><span class="pre">copy.replace()</span></code></a> for AST nodes.
(Contributed by Bénédikt Tran in <a class="reference external" href="https://github.com/python/cpython/issues/121141">gh-121141</a>.)</p></li>
<li><p>Docstrings are now removed from an optimized AST in optimization level 2.
(Contributed by Irit Katriel in <a class="reference external" href="https://github.com/python/cpython/issues/123958">gh-123958</a>.)</p></li>
<li><p>The <a class="reference internal" href="../library/functions.html#repr" title="repr"><code class="xref py py-func docutils literal notranslate"><span class="pre">repr()</span></code></a> output for AST nodes now includes more information.
(Contributed by Tomas Roun in <a class="reference external" href="https://github.com/python/cpython/issues/116022">gh-116022</a>.)</p></li>
<li><p>When called with an AST as input, the <a class="reference internal" href="../library/ast.html#ast.parse" title="ast.parse"><code class="xref py py-func docutils literal notranslate"><span class="pre">parse()</span></code></a> function
now always verifies that the root node type is appropriate.
(Contributed by Irit Katriel in <a class="reference external" href="https://github.com/python/cpython/issues/130139">gh-130139</a>.)</p></li>
<li><p>Add new options to the command-line interface:
<a class="reference internal" href="../library/ast.html#cmdoption-ast-feature-version"><code class="xref std std-option docutils literal notranslate"><span class="pre">--feature-version</span></code></a>,
<a class="reference internal" href="../library/ast.html#cmdoption-ast-optimize"><code class="xref std std-option docutils literal notranslate"><span class="pre">--optimize</span></code></a>, and
<a class="reference internal" href="../library/ast.html#cmdoption-ast-show-empty"><code class="xref std std-option docutils literal notranslate"><span class="pre">--show-empty</span></code></a>.
(Contributed by Semyon Moroz in <a class="reference external" href="https://github.com/python/cpython/issues/133367">gh-133367</a>.)</p></li>
</ul>
</section>
<section id="asyncio">
<h3>asyncio<a class="headerlink" href="#asyncio" title="Link to this heading">¶</a></h3>
<ul>
<li><p>The function and methods named <code class="xref py py-func docutils literal notranslate"><span class="pre">create_task()</span></code> now take an arbitrary
list of keyword arguments. All keyword arguments are passed to the
<a class="reference internal" href="../library/asyncio-task.html#asyncio.Task" title="asyncio.Task"><code class="xref py py-class docutils literal notranslate"><span class="pre">Task</span></code></a> constructor or the custom task factory.
(See <a class="reference internal" href="../library/asyncio-eventloop.html#asyncio.loop.set_task_factory" title="asyncio.loop.set_task_factory"><code class="xref py py-meth docutils literal notranslate"><span class="pre">set_task_factory()</span></code></a> for details.)
The <code class="docutils literal notranslate"><span class="pre">name</span></code> and <code class="docutils literal notranslate"><span class="pre">context</span></code> keyword arguments are no longer special;
the name should now be set using the <code class="docutils literal notranslate"><span class="pre">name</span></code> keyword argument of the factory,
and <code class="docutils literal notranslate"><span class="pre">context</span></code> may be <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
<p>This affects the following function and methods:
<a class="reference internal" href="../library/asyncio-task.html#asyncio.create_task" title="asyncio.create_task"><code class="xref py py-meth docutils literal notranslate"><span class="pre">asyncio.create_task()</span></code></a>,
<a class="reference internal" href="../library/asyncio-eventloop.html#asyncio.loop.create_task" title="asyncio.loop.create_task"><code class="xref py py-meth docutils literal notranslate"><span class="pre">asyncio.loop.create_task()</span></code></a>,
<a class="reference internal" href="../library/asyncio-task.html#asyncio.TaskGroup.create_task" title="asyncio.TaskGroup.create_task"><code class="xref py py-meth docutils literal notranslate"><span class="pre">asyncio.TaskGroup.create_task()</span></code></a>.</p>
<p>(Contributed by Thomas Grainger in <a class="reference external" href="https://github.com/python/cpython/issues/128307">gh-128307</a>.)</p>
</li>
<li><p>There are two new utility functions for
introspecting and printing a program’s call graph:
<a class="reference internal" href="../library/asyncio-graph.html#asyncio.capture_call_graph" title="asyncio.capture_call_graph"><code class="xref py py-func docutils literal notranslate"><span class="pre">capture_call_graph()</span></code></a> and <a class="reference internal" href="../library/asyncio-graph.html#asyncio.print_call_graph" title="asyncio.print_call_graph"><code class="xref py py-func docutils literal notranslate"><span class="pre">print_call_graph()</span></code></a>.
See <a class="reference internal" href="#whatsnew314-asyncio-introspection"><span class="std std-ref">Asyncio introspection capabilities</span></a> for more details.
(Contributed by Yury Selivanov, Pablo Galindo Salgado, and Łukasz Langa
in <a class="reference external" href="https://github.com/python/cpython/issues/91048">gh-91048</a>.)</p></li>
</ul>
</section>
<section id="calendar">
<h3>calendar<a class="headerlink" href="#calendar" title="Link to this heading">¶</a></h3>
<ul class="simple" id="whatsnew314-color-calendar">
<li><p>By default, today’s date is highlighted in color in <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>’s
<a class="reference internal" href="../library/calendar.html#calendar-cli"><span class="std std-ref">command-line</span></a> text output.
This can be controlled by <a class="reference internal" href="../using/cmdline.html#using-on-controlling-color"><span class="std std-ref">environment variables</span></a>.
(Contributed by Hugo van Kemenade in <a class="reference external" href="https://github.com/python/cpython/issues/128317">gh-128317</a>.)</p></li>
</ul>
</section>
<section id="concurrent-futures">
<h3>concurrent.futures<a class="headerlink" href="#concurrent-futures" title="Link to this heading">¶</a></h3>
<ul id="whatsnew314-concurrent-futures-interp-pool">
<li><p>Add a new executor class, <a class="reference internal" href="../library/concurrent.futures.html#concurrent.futures.InterpreterPoolExecutor" title="concurrent.futures.InterpreterPoolExecutor"><code class="xref py py-class docutils literal notranslate"><span class="pre">InterpreterPoolExecutor</span></code></a>,
which exposes multiple Python interpreters in the same process
(‘subinterpreters’) to Python code.
This uses a pool of independent Python interpreters to execute calls
asynchronously.</p>
<p>This is separate from the new <a class="reference internal" href="../library/concurrent.interpreters.html#module-concurrent.interpreters" title="concurrent.interpreters: Multiple interpreters in the same process"><code class="xref py py-mod docutils literal notranslate"><span class="pre">interpreters</span></code></a> module
introduced by <a class="reference internal" href="#whatsnew314-multiple-interpreters"><span class="std std-ref">PEP 734</span></a>.
(Contributed by Eric Snow in <a class="reference external" href="https://github.com/python/cpython/issues/124548">gh-124548</a>.)</p>
</li>
</ul>
<ul id="whatsnew314-concurrent-futures-start-method">
<li><p>On Unix platforms other than macOS, <a class="reference internal" href="../library/multiprocessing.html#multiprocessing-start-method-forkserver"><span class="std std-ref">‘forkserver’</span></a> is now the the default <a class="reference internal" href="../library/multiprocessing.html#multiprocessing-start-methods"><span class="std std-ref">start
method</span></a> for
<a class="reference internal" href="../library/concurrent.futures.html#concurrent.futures.ProcessPoolExecutor" title="concurrent.futures.ProcessPoolExecutor"><code class="xref py py-class docutils literal notranslate"><span class="pre">ProcessPoolExecutor</span></code></a>
(replacing <a class="reference internal" href="../library/multiprocessing.html#multiprocessing-start-method-fork"><span class="std std-ref">‘fork’</span></a>).
This change does not affect Windows or macOS, where <a class="reference internal" href="../library/multiprocessing.html#multiprocessing-start-method-spawn"><span class="std std-ref">‘spawn’</span></a> remains the default start method.</p>
<p>If the threading incompatible <em>fork</em> method is required, you must explicitly
request it by supplying a multiprocessing context <em>mp_context</em> to
<a class="reference internal" href="../library/concurrent.futures.html#concurrent.futures.ProcessPoolExecutor" title="concurrent.futures.ProcessPoolExecutor"><code class="xref py py-class docutils literal notranslate"><span class="pre">ProcessPoolExecutor</span></code></a>.</p>
<p>See <a class="reference internal" href="../library/multiprocessing.html#multiprocessing-programming-forkserver"><span class="std std-ref">forkserver restrictions</span></a>
for information and differences with the <em>fork</em> method and how this change
may affect existing code with mutable global shared variables and/or shared
objects that can not be automatically <a class="reference internal" href="../library/pickle.html#module-pickle" title="pickle: Convert Python objects to streams of bytes and back."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pickled</span></code></a>.</p>
<p>(Contributed by Gregory P. Smith in <a class="reference external" href="https://github.com/python/cpython/issues/84559">gh-84559</a>.)</p>
</li>
<li><p>Add two new methods to <a class="reference internal" href="../library/concurrent.futures.html#concurrent.futures.ProcessPoolExecutor" title="concurrent.futures.ProcessPoolExecutor"><code class="xref py py-class docutils literal notranslate"><span class="pre">ProcessPoolExecutor</span></code></a>,
<a class="reference internal" href="../library/concurrent.futures.html#concurrent.futures.ProcessPoolExecutor.terminate_workers" title="concurrent.futures.ProcessPoolExecutor.terminate_workers"><code class="xref py py-meth docutils literal notranslate"><span class="pre">terminate_workers()</span></code></a>
and <a class="reference internal" href="../library/concurrent.futures.html#concurrent.futures.ProcessPoolExecutor.kill_workers" title="concurrent.futures.ProcessPoolExecutor.kill_workers"><code class="xref py py-meth docutils literal notranslate"><span class="pre">kill_workers()</span></code></a>,
as ways to terminate or kill all living worker processes in the given pool.
(Contributed by Charles Machalow in <a class="reference external" href="https://github.com/python/cpython/issues/130849">gh-130849</a>.)</p></li>
<li><p>Add the optional <em>buffersize</em> parameter to <a class="reference internal" href="../library/concurrent.futures.html#concurrent.futures.Executor.map" title="concurrent.futures.Executor.map"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Executor.map</span></code></a> to limit the number of submitted
tasks whose results have not yet been yielded. If the buffer is full,
iteration over the <em>iterables</em> pauses until a result is yielded from the
buffer.
(Contributed by Enzo Bonnal and Josh Rosenberg in <a class="reference external" href="https://github.com/python/cpython/issues/74028">gh-74028</a>.)</p></li>
</ul>
</section>
<section id="configparser">
<h3>configparser<a class="headerlink" href="#configparser" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p><code class="xref py py-mod docutils literal notranslate"><span class="pre">configparser</span></code> will no longer write config files it cannot read,
to improve security.
Attempting to <a class="reference internal" href="../library/configparser.html#configparser.ConfigParser.write" title="configparser.ConfigParser.write"><code class="xref py py-meth docutils literal notranslate"><span class="pre">write()</span></code></a> keys containing
delimiters or beginning with the section header pattern will raise an
<a class="reference internal" href="../library/configparser.html#configparser.InvalidWriteError" title="configparser.InvalidWriteError"><code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidWriteError</span></code></a>.
(Contributed by Jacob Lincoln in <a class="reference external" href="https://github.com/python/cpython/issues/129270">gh-129270</a>.)</p></li>
</ul>
</section>
<section id="contextvars">
<h3>contextvars<a class="headerlink" href="#contextvars" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Support the <a class="reference internal" href="../glossary.html#term-context-manager"><span class="xref std std-term">context manager</span></a> protocol
for <a class="reference internal" href="../library/contextvars.html#contextvars.Token" title="contextvars.Token"><code class="xref py py-class docutils literal notranslate"><span class="pre">Token</span></code></a> objects.
(Contributed by Andrew Svetlov in <a class="reference external" href="https://github.com/python/cpython/issues/129889">gh-129889</a>.)</p></li>
</ul>
</section>
<section id="ctypes">
<h3>ctypes<a class="headerlink" href="#ctypes" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>The layout of <a class="reference internal" href="../library/ctypes.html#ctypes-bit-fields-in-structures-unions"><span class="std std-ref">bit fields</span></a>
in <a class="reference internal" href="../library/ctypes.html#ctypes.Structure" title="ctypes.Structure"><code class="xref py py-class docutils literal notranslate"><span class="pre">Structure</span></code></a> and <a class="reference internal" href="../library/ctypes.html#ctypes.Union" title="ctypes.Union"><code class="xref py py-class docutils literal notranslate"><span class="pre">Union</span></code></a> objects
is now a closer match to platform defaults (GCC/Clang or MSVC).
In particular, fields no longer overlap.
(Contributed by Matthias Görgens in <a class="reference external" href="https://github.com/python/cpython/issues/97702">gh-97702</a>.)</p></li>
<li><p>The <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">Structure._layout_</span></code></a> class attribute can now be set
to help match a non-default ABI.
(Contributed by Petr Viktorin in <a class="reference external" href="https://github.com/python/cpython/issues/97702">gh-97702</a>.)</p></li>
<li><p>The class of <a class="reference internal" href="../library/ctypes.html#ctypes.Structure" title="ctypes.Structure"><code class="xref py py-class docutils literal notranslate"><span class="pre">Structure</span></code></a>/<a class="reference internal" href="../library/ctypes.html#ctypes.Union" title="ctypes.Union"><code class="xref py py-class docutils literal notranslate"><span class="pre">Union</span></code></a>
field descriptors is now available as <a class="reference internal" href="../library/ctypes.html#ctypes.CField" title="ctypes.CField"><code class="xref py py-class docutils literal notranslate"><span class="pre">CField</span></code></a>,
and has new attributes to aid debugging and introspection.
(Contributed by Petr Viktorin in <a class="reference external" href="https://github.com/python/cpython/issues/128715">gh-128715</a>.)</p></li>
<li><p>On Windows, the <a class="reference internal" href="../library/ctypes.html#ctypes.COMError" title="ctypes.COMError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">COMError</span></code></a> exception is now public.
(Contributed by Jun Komoda in <a class="reference external" href="https://github.com/python/cpython/issues/126686">gh-126686</a>.)</p></li>
<li><p>On Windows, the <a class="reference internal" href="../library/ctypes.html#ctypes.CopyComPointer" title="ctypes.CopyComPointer"><code class="xref py py-func docutils literal notranslate"><span class="pre">CopyComPointer()</span></code></a> function is now public.
(Contributed by Jun Komoda in <a class="reference external" href="https://github.com/python/cpython/issues/127275">gh-127275</a>.)</p></li>
<li><p>Add <a class="reference internal" href="../library/ctypes.html#ctypes.memoryview_at" title="ctypes.memoryview_at"><code class="xref py py-func docutils literal notranslate"><span class="pre">memoryview_at()</span></code></a>, a function to create a
<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> object that refers to the supplied pointer and
length. This works like <a class="reference internal" href="../library/ctypes.html#ctypes.string_at" title="ctypes.string_at"><code class="xref py py-func docutils literal notranslate"><span class="pre">ctypes.string_at()</span></code></a> except it avoids a
buffer copy, and is typically useful when implementing pure Python
callback functions that are passed dynamically-sized buffers.
(Contributed by Rian Hunter in <a class="reference external" href="https://github.com/python/cpython/issues/112018">gh-112018</a>.)</p></li>
<li><p>Complex types, <a class="reference internal" href="../library/ctypes.html#ctypes.c_float_complex" title="ctypes.c_float_complex"><code class="xref py py-class docutils literal notranslate"><span class="pre">c_float_complex</span></code></a>,
<a class="reference internal" href="../library/ctypes.html#ctypes.c_double_complex" title="ctypes.c_double_complex"><code class="xref py py-class docutils literal notranslate"><span class="pre">c_double_complex</span></code></a>, and <a class="reference internal" href="../library/ctypes.html#ctypes.c_longdouble_complex" title="ctypes.c_longdouble_complex"><code class="xref py py-class docutils literal notranslate"><span class="pre">c_longdouble_complex</span></code></a>,
are now available if both the compiler and the <code class="docutils literal notranslate"><span class="pre">libffi</span></code> library support
complex C types.
(Contributed by Sergey B Kirpichev in <a class="reference external" href="https://github.com/python/cpython/issues/61103">gh-61103</a>.)</p></li>
<li><p>Add <a class="reference internal" href="../library/ctypes.html#ctypes.util.dllist" title="ctypes.util.dllist"><code class="xref py py-func docutils literal notranslate"><span class="pre">ctypes.util.dllist()</span></code></a> for listing the shared libraries
loaded by the current process.
(Contributed by Brian Ward in <a class="reference external" href="https://github.com/python/cpython/issues/119349">gh-119349</a>.)</p></li>
<li><p>Move <a class="reference internal" href="../library/ctypes.html#ctypes.POINTER" title="ctypes.POINTER"><code class="xref py py-func docutils literal notranslate"><span class="pre">ctypes.POINTER()</span></code></a> types cache from a global internal cache
(<code class="docutils literal notranslate"><span class="pre">_pointer_type_cache</span></code>) to the <a class="reference internal" href="../library/ctypes.html#ctypes._CData.__pointer_type__" title="ctypes._CData.__pointer_type__"><code class="xref py py-attr docutils literal notranslate"><span class="pre">_CData.__pointer_type__</span></code></a> attribute of the corresponding
<code class="xref py py-mod docutils literal notranslate"><span class="pre">ctypes</span></code> types.
This will stop the cache from growing without limits in some situations.
(Contributed by Sergey Miryanov in <a class="reference external" href="https://github.com/python/cpython/issues/100926">gh-100926</a>.)</p></li>
<li><p>The <a class="reference internal" href="../library/ctypes.html#ctypes.py_object" title="ctypes.py_object"><code class="xref py py-class docutils literal notranslate"><span class="pre">py_object</span></code></a> type now supports subscription,
making it a <a class="reference internal" href="../glossary.html#term-generic-type"><span class="xref std std-term">generic type</span></a>.
(Contributed by Brian Schubert in <a class="reference external" href="https://github.com/python/cpython/issues/132168">gh-132168</a>.)</p></li>
<li><p><code class="xref py py-mod docutils literal notranslate"><span class="pre">ctypes</span></code> now supports <a class="reference internal" href="../glossary.html#term-free-threading"><span class="xref std std-term">free-threading builds</span></a>.
(Contributed by Kumar Aditya and Peter Bierma in <a class="reference external" href="https://github.com/python/cpython/issues/127945">gh-127945</a>.)</p></li>
</ul>
</section>
<section id="curses">
<h3>curses<a class="headerlink" href="#curses" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add the <a class="reference internal" href="../library/curses.html#curses.assume_default_colors" title="curses.assume_default_colors"><code class="xref py py-func docutils literal notranslate"><span class="pre">assume_default_colors()</span></code></a> function,
a refinement of the <a class="reference internal" href="../library/curses.html#curses.use_default_colors" title="curses.use_default_colors"><code class="xref py py-func docutils literal notranslate"><span class="pre">use_default_colors()</span></code></a> function which
allows changing the color pair <code class="docutils literal notranslate"><span class="pre">0</span></code>.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/133139">gh-133139</a>.)</p></li>
</ul>
</section>
<section id="datetime">
<h3>datetime<a class="headerlink" href="#datetime" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add the <a class="reference internal" href="../library/datetime.html#datetime.date.strptime" title="datetime.date.strptime"><code class="xref py py-meth docutils literal notranslate"><span class="pre">strptime()</span></code></a> method to the
<a class="reference internal" href="../library/datetime.html#datetime.date" title="datetime.date"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.date</span></code></a> and <a class="reference internal" href="../library/datetime.html#datetime.time" title="datetime.time"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.time</span></code></a> classes.
(Contributed by Wannes Boeykens in <a class="reference external" href="https://github.com/python/cpython/issues/41431">gh-41431</a>.)</p></li>
</ul>
</section>
<section id="decimal">
<h3>decimal<a class="headerlink" href="#decimal" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add <a class="reference internal" href="../library/decimal.html#decimal.Decimal.from_number" title="decimal.Decimal.from_number"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Decimal.from_number()</span></code></a> as an alternative constructor for
<a class="reference internal" href="../library/decimal.html#decimal.Decimal" title="decimal.Decimal"><code class="xref py py-class docutils literal notranslate"><span class="pre">Decimal</span></code></a>.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/121798">gh-121798</a>.)</p></li>
<li><p>Expose <a class="reference internal" href="../library/decimal.html#decimal.IEEEContext" title="decimal.IEEEContext"><code class="xref py py-func docutils literal notranslate"><span class="pre">IEEEContext()</span></code></a> to support creation of contexts
corresponding to the IEEE 754 (2008) decimal interchange formats.
(Contributed by Sergey B Kirpichev in <a class="reference external" href="https://github.com/python/cpython/issues/53032">gh-53032</a>.)</p></li>
</ul>
</section>
<section id="difflib">
<h3>difflib<a class="headerlink" href="#difflib" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Comparison pages with highlighted changes generated by the
<a class="reference internal" href="../library/difflib.html#difflib.HtmlDiff" title="difflib.HtmlDiff"><code class="xref py py-class docutils literal notranslate"><span class="pre">HtmlDiff</span></code></a> class now support ‘dark mode’.
(Contributed by Jiahao Li in <a class="reference external" href="https://github.com/python/cpython/issues/129939">gh-129939</a>.)</p></li>
</ul>
</section>
<section id="dis">
<h3>dis<a class="headerlink" href="#dis" title="Link to this heading">¶</a></h3>
<ul>
<li><p>Add support for rendering full source location information of
<a class="reference internal" href="../library/dis.html#dis.Instruction" title="dis.Instruction"><code class="xref py py-class docutils literal notranslate"><span class="pre">instructions</span></code></a>, rather than only the line number.
This feature is added to the following interfaces via the <em>show_positions</em>
keyword argument:</p>
<ul class="simple">
<li><p><a class="reference internal" href="../library/dis.html#dis.Bytecode" title="dis.Bytecode"><code class="xref py py-class docutils literal notranslate"><span class="pre">dis.Bytecode</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/dis.html#dis.dis" title="dis.dis"><code class="xref py py-func docutils literal notranslate"><span class="pre">dis.dis()</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/dis.html#dis.distb" title="dis.distb"><code class="xref py py-func docutils literal notranslate"><span class="pre">dis.distb()</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/dis.html#dis.disassemble" title="dis.disassemble"><code class="xref py py-func docutils literal notranslate"><span class="pre">dis.disassemble()</span></code></a></p></li>
</ul>
<p>This feature is also exposed via <a class="reference internal" href="../library/dis.html#cmdoption-dis-P"><code class="xref std std-option docutils literal notranslate"><span class="pre">dis</span> <span class="pre">--show-positions</span></code></a>.
(Contributed by Bénédikt Tran in <a class="reference external" href="https://github.com/python/cpython/issues/123165">gh-123165</a>.)</p>
</li>
<li><p>Add the <a class="reference internal" href="../library/dis.html#cmdoption-dis-S"><code class="xref std std-option docutils literal notranslate"><span class="pre">dis</span> <span class="pre">--specialized</span></code></a> command-line option to
show specialized bytecode.
(Contributed by Bénédikt Tran in <a class="reference external" href="https://github.com/python/cpython/issues/127413">gh-127413</a>.)</p></li>
</ul>
</section>
<section id="errno">
<h3>errno<a class="headerlink" href="#errno" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add the <a class="reference internal" href="../library/errno.html#errno.EHWPOISON" title="errno.EHWPOISON"><code class="xref py py-data docutils literal notranslate"><span class="pre">EHWPOISON</span></code></a> error code constant.
(Contributed by James Roy in <a class="reference external" href="https://github.com/python/cpython/issues/126585">gh-126585</a>.)</p></li>
</ul>
</section>
<section id="faulthandler">
<h3>faulthandler<a class="headerlink" href="#faulthandler" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add support for printing the C stack trace on systems that
<a class="reference internal" href="../library/faulthandler.html#c-stack-compatibility"><span class="std std-ref">support it</span></a> via the new
<a class="reference internal" href="../library/faulthandler.html#faulthandler.dump_c_stack" title="faulthandler.dump_c_stack"><code class="xref py py-func docutils literal notranslate"><span class="pre">dump_c_stack()</span></code></a> function or via the <em>c_stack</em> argument
in <a class="reference internal" href="../library/faulthandler.html#faulthandler.enable" title="faulthandler.enable"><code class="xref py py-func docutils literal notranslate"><span class="pre">faulthandler.enable()</span></code></a>.
(Contributed by Peter Bierma in <a class="reference external" href="https://github.com/python/cpython/issues/127604">gh-127604</a>.)</p></li>
</ul>
</section>
<section id="fnmatch">
<h3>fnmatch<a class="headerlink" href="#fnmatch" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add <a class="reference internal" href="../library/fnmatch.html#fnmatch.filterfalse" title="fnmatch.filterfalse"><code class="xref py py-func docutils literal notranslate"><span class="pre">filterfalse()</span></code></a>, a function to reject names
matching a given pattern.
(Contributed by Bénédikt Tran in <a class="reference external" href="https://github.com/python/cpython/issues/74598">gh-74598</a>.)</p></li>
</ul>
</section>
<section id="fractions">
<h3>fractions<a class="headerlink" href="#fractions" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>A <a class="reference internal" href="../library/fractions.html#fractions.Fraction" title="fractions.Fraction"><code class="xref py py-class docutils literal notranslate"><span class="pre">Fraction</span></code></a> object may now be constructed from any
object with the <code class="xref py py-meth docutils literal notranslate"><span class="pre">as_integer_ratio()</span></code> method.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/82017">gh-82017</a>.)</p></li>
<li><p>Add <a class="reference internal" href="../library/fractions.html#fractions.Fraction.from_number" title="fractions.Fraction.from_number"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Fraction.from_number()</span></code></a> as an alternative constructor for
<a class="reference internal" href="../library/fractions.html#fractions.Fraction" title="fractions.Fraction"><code class="xref py py-class docutils literal notranslate"><span class="pre">Fraction</span></code></a>.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/121797">gh-121797</a>.)</p></li>
</ul>
</section>
<section id="functools">
<h3>functools<a class="headerlink" href="#functools" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add the <a class="reference internal" href="../library/functools.html#functools.Placeholder" title="functools.Placeholder"><code class="xref py py-data docutils literal notranslate"><span class="pre">Placeholder</span></code></a> sentinel.
This may be used with the <a class="reference internal" href="../library/functools.html#functools.partial" title="functools.partial"><code class="xref py py-func docutils literal notranslate"><span class="pre">partial()</span></code></a>
or <a class="reference internal" href="../library/functools.html#functools.partialmethod" title="functools.partialmethod"><code class="xref py py-func docutils literal notranslate"><span class="pre">partialmethod()</span></code></a> functions to reserve a place
for positional arguments in the returned <a class="reference internal" href="../library/functools.html#partial-objects"><span class="std std-ref">partial object</span></a>.
(Contributed by Dominykas Grigonis in <a class="reference external" href="https://github.com/python/cpython/issues/119127">gh-119127</a>.)</p></li>
<li><p>Allow the <em>initial</em> parameter 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">reduce()</span></code></a> to be passed
as a keyword argument.
(Contributed by Sayandip Dutta in <a class="reference external" href="https://github.com/python/cpython/issues/125916">gh-125916</a>.)</p></li>
</ul>
</section>
<section id="getopt">
<h3>getopt<a class="headerlink" href="#getopt" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add support for options with optional arguments.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/126374">gh-126374</a>.)</p></li>
<li><p>Add support for returning intermixed options and non-option arguments in order.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/126390">gh-126390</a>.)</p></li>
</ul>
</section>
<section id="getpass">
<h3>getpass<a class="headerlink" href="#getpass" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Support keyboard feedback in the <a class="reference internal" href="../library/getpass.html#getpass.getpass" title="getpass.getpass"><code class="xref py py-func docutils literal notranslate"><span class="pre">getpass()</span></code></a> function via
the keyword-only optional argument <em>echo_char</em>.
Placeholder characters are rendered whenever a character is entered,
and removed when a character is deleted.
(Contributed by Semyon Moroz in <a class="reference external" href="https://github.com/python/cpython/issues/77065">gh-77065</a>.)</p></li>
</ul>
</section>
<section id="graphlib">
<h3>graphlib<a class="headerlink" href="#graphlib" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Allow <a class="reference internal" href="../library/graphlib.html#graphlib.TopologicalSorter.prepare" title="graphlib.TopologicalSorter.prepare"><code class="xref py py-meth docutils literal notranslate"><span class="pre">TopologicalSorter.prepare()</span></code></a> to be called more than once
as long as sorting has not started.
(Contributed by Daniel Pope in <a class="reference external" href="https://github.com/python/cpython/issues/130914">gh-130914</a>.)</p></li>
</ul>
</section>
<section id="heapq">
<h3>heapq<a class="headerlink" href="#heapq" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>The <code class="xref py py-mod docutils literal notranslate"><span class="pre">heapq</span></code> module has improved support for working with max-heaps,
via the following new functions:</p>
<ul>
<li><p><a class="reference internal" href="../library/heapq.html#heapq.heapify_max" title="heapq.heapify_max"><code class="xref py py-func docutils literal notranslate"><span class="pre">heapify_max()</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/heapq.html#heapq.heappush_max" title="heapq.heappush_max"><code class="xref py py-func docutils literal notranslate"><span class="pre">heappush_max()</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/heapq.html#heapq.heappop_max" title="heapq.heappop_max"><code class="xref py py-func docutils literal notranslate"><span class="pre">heappop_max()</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/heapq.html#heapq.heapreplace_max" title="heapq.heapreplace_max"><code class="xref py py-func docutils literal notranslate"><span class="pre">heapreplace_max()</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/heapq.html#heapq.heappushpop_max" title="heapq.heappushpop_max"><code class="xref py py-func docutils literal notranslate"><span class="pre">heappushpop_max()</span></code></a></p></li>
</ul>
</li>
</ul>
</section>
<section id="hmac">
<h3>hmac<a class="headerlink" href="#hmac" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add a built-in implementation for HMAC (<span class="target" id="index-36"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2104.html"><strong>RFC 2104</strong></a>) using formally verified
code from the <a class="reference external" href="https://github.com/hacl-star/hacl-star/">HACL*</a> project.
This implementation is used as a fallback when the OpenSSL implementation
of HMAC is not available.
(Contributed by Bénédikt Tran in <a class="reference external" href="https://github.com/python/cpython/issues/99108">gh-99108</a>.)</p></li>
</ul>
</section>
<section id="http">
<h3>http<a class="headerlink" href="#http" title="Link to this heading">¶</a></h3>
<ul>
<li><p>Directory lists and error pages generated by the <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>
module allow the browser to apply its default dark mode.
(Contributed by Yorik Hansen in <a class="reference external" href="https://github.com/python/cpython/issues/123430">gh-123430</a>.)</p></li>
<li><p>The <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> module now supports serving over HTTPS using the
<a class="reference internal" href="../library/http.server.html#http.server.HTTPSServer" title="http.server.HTTPSServer"><code class="xref py py-class docutils literal notranslate"><span class="pre">http.server.HTTPSServer</span></code></a> class. This functionality is exposed by
the command-line interface (<code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">http.server</span></code>) through the following
options:</p>
<ul class="simple">
<li><p><a class="reference internal" href="../library/http.server.html#cmdoption-http.server-tls-cert"><code class="xref std std-option docutils literal notranslate"><span class="pre">--tls-cert</span> <span class="pre"><path></span></code></a>:
Path to the TLS certificate file.</p></li>
<li><p><a class="reference internal" href="../library/http.server.html#cmdoption-http.server-tls-key"><code class="xref std std-option docutils literal notranslate"><span class="pre">--tls-key</span> <span class="pre"><path></span></code></a>:
Optional path to the private key file.</p></li>
<li><p><a class="reference internal" href="../library/http.server.html#cmdoption-http.server-tls-password-file"><code class="xref std std-option docutils literal notranslate"><span class="pre">--tls-password-file</span> <span class="pre"><path></span></code></a>:
Optional path to the password file for the private key.</p></li>
</ul>
<p>(Contributed by Semyon Moroz in <a class="reference external" href="https://github.com/python/cpython/issues/85162">gh-85162</a>.)</p>
</li>
</ul>
</section>
<section id="imaplib">
<h3>imaplib<a class="headerlink" href="#imaplib" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add <a class="reference internal" href="../library/imaplib.html#imaplib.IMAP4.idle" title="imaplib.IMAP4.idle"><code class="xref py py-meth docutils literal notranslate"><span class="pre">IMAP4.idle()</span></code></a>, implementing the IMAP4
<code class="docutils literal notranslate"><span class="pre">IDLE</span></code> command as defined in <span class="target" id="index-37"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2177.html"><strong>RFC 2177</strong></a>.
(Contributed by Forest in <a class="reference external" href="https://github.com/python/cpython/issues/55454">gh-55454</a>.)</p></li>
</ul>
</section>
<section id="inspect">
<h3>inspect<a class="headerlink" href="#inspect" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p><a class="reference internal" href="../library/inspect.html#inspect.signature" title="inspect.signature"><code class="xref py py-func docutils literal notranslate"><span class="pre">signature()</span></code></a> takes a new argument <em>annotation_format</em> to control
the <a class="reference internal" href="../library/annotationlib.html#annotationlib.Format" title="annotationlib.Format"><code class="xref py py-class docutils literal notranslate"><span class="pre">annotationlib.Format</span></code></a> used for representing annotations.
(Contributed by Jelle Zijlstra in <a class="reference external" href="https://github.com/python/cpython/issues/101552">gh-101552</a>.)</p></li>
<li><p><a class="reference internal" href="../library/inspect.html#inspect.Signature.format" title="inspect.Signature.format"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Signature.format()</span></code></a> takes a new argument <em>unquote_annotations</em>.
If true, string <a class="reference internal" href="../glossary.html#term-annotation"><span class="xref std std-term">annotations</span></a> are displayed without
surrounding quotes.
(Contributed by Jelle Zijlstra in <a class="reference external" href="https://github.com/python/cpython/issues/101552">gh-101552</a>.)</p></li>
<li><p>Add function <a class="reference internal" href="../library/inspect.html#inspect.ispackage" title="inspect.ispackage"><code class="xref py py-func docutils literal notranslate"><span class="pre">ispackage()</span></code></a> to determine whether an object is a
<a class="reference internal" href="../glossary.html#term-package"><span class="xref std std-term">package</span></a> or not.
(Contributed by Zhikang Yan in <a class="reference external" href="https://github.com/python/cpython/issues/125634">gh-125634</a>.)</p></li>
</ul>
</section>
<section id="io">
<h3>io<a class="headerlink" href="#io" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Reading text from a non-blocking stream with <code class="docutils literal notranslate"><span class="pre">read</span></code> may now raise a
<a class="reference internal" href="../library/exceptions.html#BlockingIOError" title="BlockingIOError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">BlockingIOError</span></code></a> if the operation cannot immediately return bytes.
(Contributed by Giovanni Siragusa in <a class="reference external" href="https://github.com/python/cpython/issues/109523">gh-109523</a>.)</p></li>
<li><p>Add the <a class="reference internal" href="../library/io.html#io.Reader" title="io.Reader"><code class="xref py py-class docutils literal notranslate"><span class="pre">Reader</span></code></a> and <a class="reference internal" href="../library/io.html#io.Writer" title="io.Writer"><code class="xref py py-class docutils literal notranslate"><span class="pre">Writer</span></code></a> protocols as simpler
alternatives to the pseudo-protocols <a class="reference internal" href="../library/typing.html#typing.IO" title="typing.IO"><code class="xref py py-class docutils literal notranslate"><span class="pre">typing.IO</span></code></a>,
<a class="reference internal" href="../library/typing.html#typing.TextIO" title="typing.TextIO"><code class="xref py py-class docutils literal notranslate"><span class="pre">typing.TextIO</span></code></a>, and <a class="reference internal" href="../library/typing.html#typing.BinaryIO" title="typing.BinaryIO"><code class="xref py py-class docutils literal notranslate"><span class="pre">typing.BinaryIO</span></code></a>.
(Contributed by Sebastian Rittau in <a class="reference external" href="https://github.com/python/cpython/issues/127648">gh-127648</a>.)</p></li>
</ul>
</section>
<section id="json">
<h3>json<a class="headerlink" href="#json" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add exception notes for JSON serialization errors that allow
identifying the source of the error.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/122163">gh-122163</a>.)</p></li>
<li><p>Allow using the <a class="reference internal" href="../library/json.html#module-json" title="json: Encode and decode the JSON format."><code class="xref py py-mod docutils literal notranslate"><span class="pre">json</span></code></a> module as a script using the <a class="reference internal" href="../using/cmdline.html#cmdoption-m"><code class="xref std std-option docutils literal notranslate"><span class="pre">-m</span></code></a> switch:
<strong class="program">python -m json</strong>.
This is now preferred to <strong class="program">python -m json.tool</strong>,
which is <a class="reference internal" href="../glossary.html#term-soft-deprecated"><span class="xref std std-term">soft deprecated</span></a>.
See the <a class="reference internal" href="../library/json.html#json-commandline"><span class="std std-ref">JSON command-line interface</span></a> documentation.
(Contributed by Trey Hunner in <a class="reference external" href="https://github.com/python/cpython/issues/122873">gh-122873</a>.)</p></li>
<li><p>By default, the output of the <a class="reference internal" href="../library/json.html#json-commandline"><span class="std std-ref">JSON command-line interface</span></a> is highlighted in color.
This can be controlled by <a class="reference internal" href="../using/cmdline.html#using-on-controlling-color"><span class="std std-ref">environment variables</span></a>.
(Contributed by Tomas Roun in <a class="reference external" href="https://github.com/python/cpython/issues/131952">gh-131952</a>.)</p></li>
</ul>
</section>
<section id="linecache">
<h3>linecache<a class="headerlink" href="#linecache" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p><a class="reference internal" href="../library/linecache.html#linecache.getline" title="linecache.getline"><code class="xref py py-func docutils literal notranslate"><span class="pre">getline()</span></code></a> can now retrieve source code for frozen modules.
(Contributed by Tian Gao in <a class="reference external" href="https://github.com/python/cpython/issues/131638">gh-131638</a>.)</p></li>
</ul>
</section>
<section id="logging-handlers">
<h3>logging.handlers<a class="headerlink" href="#logging-handlers" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p><a class="reference internal" href="../library/logging.handlers.html#logging.handlers.QueueListener" title="logging.handlers.QueueListener"><code class="xref py py-class docutils literal notranslate"><span class="pre">QueueListener</span></code></a> objects now support the
<a class="reference internal" href="../glossary.html#term-context-manager"><span class="xref std std-term">context manager</span></a> protocol.
(Contributed by Charles Machalow in <a class="reference external" href="https://github.com/python/cpython/issues/132106">gh-132106</a>.)</p></li>
<li><p><a class="reference internal" href="../library/logging.handlers.html#logging.handlers.QueueListener.start" title="logging.handlers.QueueListener.start"><code class="xref py py-meth docutils literal notranslate"><span class="pre">QueueListener.start</span></code></a> now
raises a <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> if the listener is already started.
(Contributed by Charles Machalow in <a class="reference external" href="https://github.com/python/cpython/issues/132106">gh-132106</a>.)</p></li>
</ul>
</section>
<section id="math">
<h3>math<a class="headerlink" href="#math" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Added more detailed error messages for domain errors in the module.
(Contributed by Charlie Zhao and Sergey B Kirpichev in <a class="reference external" href="https://github.com/python/cpython/issues/101410">gh-101410</a>.)</p></li>
</ul>
</section>
<section id="mimetypes">
<h3>mimetypes<a class="headerlink" href="#mimetypes" title="Link to this heading">¶</a></h3>
<ul>
<li><p>Add a public <a class="reference internal" href="../library/mimetypes.html#mimetypes-cli"><span class="std std-ref">command-line</span></a> for the module,
invoked via <strong class="program">python -m mimetypes</strong>.
(Contributed by Oleg Iarygin and Hugo van Kemenade in <a class="reference external" href="https://github.com/python/cpython/issues/93096">gh-93096</a>.)</p></li>
<li><p>Add several new MIME types based on RFCs and common usage:</p>
<p class="rubric">Microsoft and <span class="target" id="index-38"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc8081.html"><strong>RFC 8081</strong></a> MIME types for fonts</p>
<ul class="simple">
<li><p>Embedded OpenType: <code class="docutils literal notranslate"><span class="pre">application/vnd.ms-fontobject</span></code></p></li>
<li><p>OpenType Layout (OTF) <code class="docutils literal notranslate"><span class="pre">font/otf</span></code></p></li>
<li><p>TrueType: <code class="docutils literal notranslate"><span class="pre">font/ttf</span></code></p></li>
<li><p>WOFF 1.0 <code class="docutils literal notranslate"><span class="pre">font/woff</span></code></p></li>
<li><p>WOFF 2.0 <code class="docutils literal notranslate"><span class="pre">font/woff2</span></code></p></li>
</ul>
<p class="rubric"><span class="target" id="index-39"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9559.html"><strong>RFC 9559</strong></a> MIME types for Matroska audiovisual
data container structures</p>
<ul class="simple">
<li><p>audio with no video: <code class="docutils literal notranslate"><span class="pre">audio/matroska</span></code> (<code class="docutils literal notranslate"><span class="pre">.mka</span></code>)</p></li>
<li><p>video: <code class="docutils literal notranslate"><span class="pre">video/matroska</span></code> (<code class="docutils literal notranslate"><span class="pre">.mkv</span></code>)</p></li>
<li><p>stereoscopic video: <code class="docutils literal notranslate"><span class="pre">video/matroska-3d</span></code> (<code class="docutils literal notranslate"><span class="pre">.mk3d</span></code>)</p></li>
</ul>
<p class="rubric">Images with RFCs</p>
<ul class="simple">
<li><p><span class="target" id="index-40"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc1494.html"><strong>RFC 1494</strong></a>: CCITT Group 3 (<code class="docutils literal notranslate"><span class="pre">.g3</span></code>)</p></li>
<li><p><span class="target" id="index-41"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc3362.html"><strong>RFC 3362</strong></a>: Real-time Facsimile, T.38 (<code class="docutils literal notranslate"><span class="pre">.t38</span></code>)</p></li>
<li><p><span class="target" id="index-42"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc3745.html"><strong>RFC 3745</strong></a>: JPEG 2000 (<code class="docutils literal notranslate"><span class="pre">.jp2</span></code>), extension (<code class="docutils literal notranslate"><span class="pre">.jpx</span></code>) and compound (<code class="docutils literal notranslate"><span class="pre">.jpm</span></code>)</p></li>
<li><p><span class="target" id="index-43"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc3950.html"><strong>RFC 3950</strong></a>: Tag Image File Format Fax eXtended, TIFF-FX (<code class="docutils literal notranslate"><span class="pre">.tfx</span></code>)</p></li>
<li><p><span class="target" id="index-44"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc4047.html"><strong>RFC 4047</strong></a>: Flexible Image Transport System (<code class="docutils literal notranslate"><span class="pre">.fits</span></code>)</p></li>
<li><p><span class="target" id="index-45"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc7903.html"><strong>RFC 7903</strong></a>: Enhanced Metafile (<code class="docutils literal notranslate"><span class="pre">.emf</span></code>) and Windows Metafile (<code class="docutils literal notranslate"><span class="pre">.wmf</span></code>)</p></li>
</ul>
<p class="rubric">Other MIME type additions and changes</p>
<ul class="simple">
<li><p><span class="target" id="index-46"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2361.html"><strong>RFC 2361</strong></a>: Change type for <code class="docutils literal notranslate"><span class="pre">.avi</span></code> to <code class="docutils literal notranslate"><span class="pre">video/vnd.avi</span></code>
and for <code class="docutils literal notranslate"><span class="pre">.wav</span></code> to <code class="docutils literal notranslate"><span class="pre">audio/vnd.wave</span></code></p></li>
<li><p><span class="target" id="index-47"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc4337.html"><strong>RFC 4337</strong></a>: Add MPEG-4 <code class="docutils literal notranslate"><span class="pre">audio/mp4</span></code> (<code class="docutils literal notranslate"><span class="pre">.m4a</span></code>)</p></li>
<li><p><span class="target" id="index-48"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc5334.html"><strong>RFC 5334</strong></a>: Add Ogg media (<code class="docutils literal notranslate"><span class="pre">.oga</span></code>, <code class="docutils literal notranslate"><span class="pre">.ogg</span></code> and <code class="docutils literal notranslate"><span class="pre">.ogx</span></code>)</p></li>
<li><p><span class="target" id="index-49"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc6713.html"><strong>RFC 6713</strong></a>: Add gzip <code class="docutils literal notranslate"><span class="pre">application/gzip</span></code> (<code class="docutils literal notranslate"><span class="pre">.gz</span></code>)</p></li>
<li><p><span class="target" id="index-50"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9639.html"><strong>RFC 9639</strong></a>: Add FLAC <code class="docutils literal notranslate"><span class="pre">audio/flac</span></code> (<code class="docutils literal notranslate"><span class="pre">.flac</span></code>)</p></li>
<li><p><span class="target" id="index-51"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9512.html"><strong>RFC 9512</strong></a> <code class="docutils literal notranslate"><span class="pre">application/yaml</span></code> MIME type for YAML files (<code class="docutils literal notranslate"><span class="pre">.yaml</span></code>
and <code class="docutils literal notranslate"><span class="pre">.yml</span></code>)</p></li>
<li><p>Add 7z <code class="docutils literal notranslate"><span class="pre">application/x-7z-compressed</span></code> (<code class="docutils literal notranslate"><span class="pre">.7z</span></code>)</p></li>
<li><p>Add Android Package <code class="docutils literal notranslate"><span class="pre">application/vnd.android.package-archive</span></code> (<code class="docutils literal notranslate"><span class="pre">.apk</span></code>)
when not strict</p></li>
<li><p>Add deb <code class="docutils literal notranslate"><span class="pre">application/x-debian-package</span></code> (<code class="docutils literal notranslate"><span class="pre">.deb</span></code>)</p></li>
<li><p>Add glTF binary <code class="docutils literal notranslate"><span class="pre">model/gltf-binary</span></code> (<code class="docutils literal notranslate"><span class="pre">.glb</span></code>)</p></li>
<li><p>Add glTF JSON/ASCII <code class="docutils literal notranslate"><span class="pre">model/gltf+json</span></code> (<code class="docutils literal notranslate"><span class="pre">.gltf</span></code>)</p></li>
<li><p>Add M4V <code class="docutils literal notranslate"><span class="pre">video/x-m4v</span></code> (<code class="docutils literal notranslate"><span class="pre">.m4v</span></code>)</p></li>
<li><p>Add PHP <code class="docutils literal notranslate"><span class="pre">application/x-httpd-php</span></code> (<code class="docutils literal notranslate"><span class="pre">.php</span></code>)</p></li>
<li><p>Add RAR <code class="docutils literal notranslate"><span class="pre">application/vnd.rar</span></code> (<code class="docutils literal notranslate"><span class="pre">.rar</span></code>)</p></li>
<li><p>Add RPM <code class="docutils literal notranslate"><span class="pre">application/x-rpm</span></code> (<code class="docutils literal notranslate"><span class="pre">.rpm</span></code>)</p></li>
<li><p>Add STL <code class="docutils literal notranslate"><span class="pre">model/stl</span></code> (<code class="docutils literal notranslate"><span class="pre">.stl</span></code>)</p></li>
<li><p>Add Windows Media Video <code class="docutils literal notranslate"><span class="pre">video/x-ms-wmv</span></code> (<code class="docutils literal notranslate"><span class="pre">.wmv</span></code>)</p></li>
<li><p>De facto: Add WebM <code class="docutils literal notranslate"><span class="pre">audio/webm</span></code> (<code class="docutils literal notranslate"><span class="pre">.weba</span></code>)</p></li>
<li><p><a class="reference external" href="https://ecma-international.org/publications-and-standards/standards/ecma-376/">ECMA-376</a>:
Add <code class="docutils literal notranslate"><span class="pre">.docx</span></code>, <code class="docutils literal notranslate"><span class="pre">.pptx</span></code> and <code class="docutils literal notranslate"><span class="pre">.xlsx</span></code> types</p></li>
<li><p><a class="reference external" href="https://docs.oasis-open.org/office/v1.2/cs01/OpenDocument-v1.2-cs01-part1.html#Appendix_C">OASIS</a>:
Add OpenDocument <code class="docutils literal notranslate"><span class="pre">.odg</span></code>, <code class="docutils literal notranslate"><span class="pre">.odp</span></code>, <code class="docutils literal notranslate"><span class="pre">.ods</span></code> and <code class="docutils literal notranslate"><span class="pre">.odt</span></code> types</p></li>
<li><p><a class="reference external" href="https://www.w3.org/TR/epub-33/#app-media-type">W3C</a>:
Add EPUB <code class="docutils literal notranslate"><span class="pre">application/epub+zip</span></code> (<code class="docutils literal notranslate"><span class="pre">.epub</span></code>)</p></li>
</ul>
<p>(Contributed by Sahil Prajapati and Hugo van Kemenade in <a class="reference external" href="https://github.com/python/cpython/issues/84852">gh-84852</a>,
by Sasha “Nelie” Chernykh and Hugo van Kemenade in <a class="reference external" href="https://github.com/python/cpython/issues/132056">gh-132056</a>,
and by Hugo van Kemenade in <a class="reference external" href="https://github.com/python/cpython/issues/89416">gh-89416</a>, <a class="reference external" href="https://github.com/python/cpython/issues/85957">gh-85957</a>, and <a class="reference external" href="https://github.com/python/cpython/issues/129965">gh-129965</a>.)</p>
</li>
</ul>
</section>
<section id="multiprocessing">
<h3>multiprocessing<a class="headerlink" href="#multiprocessing" title="Link to this heading">¶</a></h3>
<ul id="whatsnew314-multiprocessing-start-method">
<li><p>On Unix platforms other than macOS, <a class="reference internal" href="../library/multiprocessing.html#multiprocessing-start-method-forkserver"><span class="std std-ref">‘forkserver’</span></a> is now the the default <a class="reference internal" href="../library/multiprocessing.html#multiprocessing-start-methods"><span class="std std-ref">start
method</span></a>
(replacing <a class="reference internal" href="../library/multiprocessing.html#multiprocessing-start-method-fork"><span class="std std-ref">‘fork’</span></a>).
This change does not affect Windows or macOS, where <a class="reference internal" href="../library/multiprocessing.html#multiprocessing-start-method-spawn"><span class="std std-ref">‘spawn’</span></a> remains the default start method.</p>
<p>If the threading incompatible <em>fork</em> method is required, you must explicitly
request it via a context from <a class="reference internal" href="../library/multiprocessing.html#multiprocessing.get_context" title="multiprocessing.get_context"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_context()</span></code></a> (preferred)
or change the default via <a class="reference internal" href="../library/multiprocessing.html#multiprocessing.set_start_method" title="multiprocessing.set_start_method"><code class="xref py py-func docutils literal notranslate"><span class="pre">set_start_method()</span></code></a>.</p>
<p>See <a class="reference internal" href="../library/multiprocessing.html#multiprocessing-programming-forkserver"><span class="std std-ref">forkserver restrictions</span></a>
for information and differences with the <em>fork</em> method and how this change
may affect existing code with mutable global shared variables and/or shared
objects that can not be automatically <a class="reference internal" href="../library/pickle.html#module-pickle" title="pickle: Convert Python objects to streams of bytes and back."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pickled</span></code></a>.</p>
<p>(Contributed by Gregory P. Smith in <a class="reference external" href="https://github.com/python/cpython/issues/84559">gh-84559</a>.)</p>
</li>
<li><p><a class="reference internal" href="../library/multiprocessing.html#module-multiprocessing" title="multiprocessing: Process-based parallelism."><code class="xref py py-mod docutils literal notranslate"><span class="pre">multiprocessing</span></code></a>’s <code class="docutils literal notranslate"><span class="pre">'forkserver'</span></code> start method now authenticates
its control socket to avoid solely relying on filesystem permissions
to restrict what other processes could cause the forkserver to spawn workers
and run code.
(Contributed by Gregory P. Smith for <a class="reference external" href="https://github.com/python/cpython/issues/97514">gh-97514</a>.)</p></li>
<li><p>The <a class="reference internal" href="../library/multiprocessing.html#multiprocessing-proxy-objects"><span class="std std-ref">multiprocessing proxy objects</span></a>
for <em>list</em> and <em>dict</em> types gain previously overlooked missing methods:</p>
<blockquote>
<div><ul class="simple">
<li><p><code class="xref py py-meth docutils literal notranslate"><span class="pre">clear()</span></code> and <code class="xref py py-meth docutils literal notranslate"><span class="pre">copy()</span></code> for proxies of <a class="reference internal" href="../library/stdtypes.html#list" title="list"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/stdtypes.html#dict.fromkeys" title="dict.fromkeys"><code class="xref py py-meth docutils literal notranslate"><span class="pre">fromkeys()</span></code></a>, <code class="docutils literal notranslate"><span class="pre">reversed(d)</span></code>, <code class="docutils literal notranslate"><span class="pre">d</span> <span class="pre">|</span> <span class="pre">{}</span></code>, <code class="docutils literal notranslate"><span class="pre">{}</span> <span class="pre">|</span> <span class="pre">d</span></code>,
<code class="docutils literal notranslate"><span class="pre">d</span> <span class="pre">|=</span> <span class="pre">{'b':</span> <span class="pre">2}</span></code> for proxies of <a class="reference internal" href="../library/stdtypes.html#dict" title="dict"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a></p></li>
</ul>
</div></blockquote>
<p>(Contributed by Roy Hyunjin Han for <a class="reference external" href="https://github.com/python/cpython/issues/103134">gh-103134</a>.)</p>
</li>
<li><p>Add support for shared <a class="reference internal" href="../library/stdtypes.html#set" title="set"><code class="xref py py-class docutils literal notranslate"><span class="pre">set</span></code></a> objects via
<a class="reference internal" href="../library/multiprocessing.html#multiprocessing.managers.SyncManager.set" title="multiprocessing.managers.SyncManager.set"><code class="xref py py-meth docutils literal notranslate"><span class="pre">SyncManager.set()</span></code></a>.
The <a class="reference internal" href="../library/stdtypes.html#set" title="set"><code class="xref py py-func docutils literal notranslate"><span class="pre">set()</span></code></a> in <a class="reference internal" href="../library/multiprocessing.html#multiprocessing.Manager" title="multiprocessing.Manager"><code class="xref py py-func docutils literal notranslate"><span class="pre">Manager()</span></code></a> method is now available.
(Contributed by Mingyu Park in <a class="reference external" href="https://github.com/python/cpython/issues/129949">gh-129949</a>.)</p></li>
<li><p>Add the <a class="reference internal" href="../library/multiprocessing.html#multiprocessing.Process.interrupt" title="multiprocessing.Process.interrupt"><code class="xref py py-meth docutils literal notranslate"><span class="pre">interrupt()</span></code></a>
to <a class="reference internal" href="../library/multiprocessing.html#multiprocessing.Process" title="multiprocessing.Process"><code class="xref py py-class docutils literal notranslate"><span class="pre">multiprocessing.Process</span></code></a> objects, which terminates the child
process by sending <a class="reference internal" href="../library/signal.html#signal.SIGINT" title="signal.SIGINT"><code class="xref py py-const docutils literal notranslate"><span class="pre">SIGINT</span></code></a>. This enables
<a class="reference internal" href="../reference/compound_stmts.html#finally"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">finally</span></code></a> clauses to print a stack trace for the terminated
process. (Contributed by Artem Pulkin in <a class="reference external" href="https://github.com/python/cpython/issues/131913">gh-131913</a>.)</p></li>
</ul>
</section>
<section id="operator">
<h3>operator<a class="headerlink" href="#operator" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add <a class="reference internal" href="../library/operator.html#operator.is_none" title="operator.is_none"><code class="xref py py-func docutils literal notranslate"><span class="pre">is_none()</span></code></a> and <a class="reference internal" href="../library/operator.html#operator.is_not_none" title="operator.is_not_none"><code class="xref py py-func docutils literal notranslate"><span class="pre">is_not_none()</span></code></a> as a pair
of functions, such that <code class="docutils literal notranslate"><span class="pre">operator.is_none(obj)</span></code> is equivalent
to <code class="docutils literal notranslate"><span class="pre">obj</span> <span class="pre">is</span> <span class="pre">None</span></code> and <code class="docutils literal notranslate"><span class="pre">operator.is_not_none(obj)</span></code> is equivalent
to <code class="docutils literal notranslate"><span class="pre">obj</span> <span class="pre">is</span> <span class="pre">not</span> <span class="pre">None</span></code>.
(Contributed by Raymond Hettinger and Nico Mexis in <a class="reference external" href="https://github.com/python/cpython/issues/115808">gh-115808</a>.)</p></li>
</ul>
</section>
<section id="os">
<h3>os<a class="headerlink" href="#os" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add the <a class="reference internal" href="../library/os.html#os.reload_environ" title="os.reload_environ"><code class="xref py py-func docutils literal notranslate"><span class="pre">reload_environ()</span></code></a> function to update <a class="reference internal" href="../library/os.html#os.environ" title="os.environ"><code class="xref py py-data docutils literal notranslate"><span class="pre">os.environ</span></code></a> and
<a class="reference internal" href="../library/os.html#os.environb" title="os.environb"><code class="xref py py-data docutils literal notranslate"><span class="pre">os.environb</span></code></a> with changes to the environment made by
<a class="reference internal" href="../library/os.html#os.putenv" title="os.putenv"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.putenv()</span></code></a>, by <a class="reference internal" href="../library/os.html#os.unsetenv" title="os.unsetenv"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.unsetenv()</span></code></a>, or made outside Python in the
same process.
(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/120057">gh-120057</a>.)</p></li>
<li><p>Add the <a class="reference internal" href="../library/os.html#os.SCHED_DEADLINE" title="os.SCHED_DEADLINE"><code class="xref py py-data docutils literal notranslate"><span class="pre">SCHED_DEADLINE</span></code></a> and <a class="reference internal" href="../library/os.html#os.SCHED_NORMAL" title="os.SCHED_NORMAL"><code class="xref py py-data docutils literal notranslate"><span class="pre">SCHED_NORMAL</span></code></a> constants
to the <code class="xref py py-mod docutils literal notranslate"><span class="pre">os</span></code> module.
(Contributed by James Roy in <a class="reference external" href="https://github.com/python/cpython/issues/127688">gh-127688</a>.)</p></li>
<li><p>Add the <a class="reference internal" href="../library/os.html#os.readinto" title="os.readinto"><code class="xref py py-func docutils literal notranslate"><span class="pre">readinto()</span></code></a> function to read into a
<a class="reference internal" href="../c-api/buffer.html#bufferobjects"><span class="std std-ref">buffer object</span></a> from a file descriptor.
(Contributed by Cody Maloney in <a class="reference external" href="https://github.com/python/cpython/issues/129205">gh-129205</a>.)</p></li>
</ul>
</section>
<section id="os-path">
<h3>os.path<a class="headerlink" href="#os-path" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>The <em>strict</em> parameter to <a class="reference internal" href="../library/os.path.html#os.path.realpath" title="os.path.realpath"><code class="xref py py-func docutils literal notranslate"><span class="pre">realpath()</span></code></a> accepts a new value,
<a class="reference internal" href="../library/os.path.html#os.path.ALLOW_MISSING" title="os.path.ALLOW_MISSING"><code class="xref py py-data docutils literal notranslate"><span class="pre">ALLOW_MISSING</span></code></a>.
If used, errors other than <a class="reference internal" href="../library/exceptions.html#FileNotFoundError" title="FileNotFoundError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">FileNotFoundError</span></code></a> will be re-raised;
the resulting path can be missing but it will be free of symlinks.
(Contributed by Petr Viktorin for <span class="target" id="index-52"></span><a class="cve reference external" href="https://www.cve.org/CVERecord?id=CVE-2025-4517"><strong>CVE 2025-4517</strong></a>.)</p></li>
</ul>
</section>
<section id="pathlib">
<h3>pathlib<a class="headerlink" href="#pathlib" title="Link to this heading">¶</a></h3>
<ul>
<li><p>Add methods to <a class="reference internal" href="../library/pathlib.html#pathlib.Path" title="pathlib.Path"><code class="xref py py-class docutils literal notranslate"><span class="pre">pathlib.Path</span></code></a> to recursively copy or move files and
directories:</p>
<ul class="simple">
<li><p><a class="reference internal" href="../library/pathlib.html#pathlib.Path.copy" title="pathlib.Path.copy"><code class="xref py py-meth docutils literal notranslate"><span class="pre">copy()</span></code></a> copies a file or directory tree to a destination.</p></li>
<li><p><a class="reference internal" href="../library/pathlib.html#pathlib.Path.copy_into" title="pathlib.Path.copy_into"><code class="xref py py-meth docutils literal notranslate"><span class="pre">copy_into()</span></code></a> copies <em>into</em> a destination directory.</p></li>
<li><p><a class="reference internal" href="../library/pathlib.html#pathlib.Path.move" title="pathlib.Path.move"><code class="xref py py-meth docutils literal notranslate"><span class="pre">move()</span></code></a> moves a file or directory tree to a destination.</p></li>
<li><p><a class="reference internal" href="../library/pathlib.html#pathlib.Path.move_into" title="pathlib.Path.move_into"><code class="xref py py-meth docutils literal notranslate"><span class="pre">move_into()</span></code></a> moves <em>into</em> a destination directory.</p></li>
</ul>
<p>(Contributed by Barney Gale in <a class="reference external" href="https://github.com/python/cpython/issues/73991">gh-73991</a>.)</p>
</li>
<li><p>Add the <a class="reference internal" href="../library/pathlib.html#pathlib.Path.info" title="pathlib.Path.info"><code class="xref py py-attr docutils literal notranslate"><span class="pre">info</span></code></a> attribute, which stores an object
implementing the new <a class="reference internal" href="../library/pathlib.html#pathlib.types.PathInfo" title="pathlib.types.PathInfo"><code class="xref py py-class docutils literal notranslate"><span class="pre">pathlib.types.PathInfo</span></code></a> protocol. The
object supports querying the file type and internally caching
<a class="reference internal" href="../library/os.html#os.stat" title="os.stat"><code class="xref py py-func docutils literal notranslate"><span class="pre">stat()</span></code></a> results. Path objects generated by
<a class="reference internal" href="../library/pathlib.html#pathlib.Path.iterdir" title="pathlib.Path.iterdir"><code class="xref py py-meth docutils literal notranslate"><span class="pre">iterdir()</span></code></a> are initialized with file type information
gleaned from scanning the parent directory.
(Contributed by Barney Gale in <a class="reference external" href="https://github.com/python/cpython/issues/125413">gh-125413</a>.)</p></li>
</ul>
</section>
<section id="pdb">
<h3>pdb<a class="headerlink" href="#pdb" title="Link to this heading">¶</a></h3>
<ul>
<li><p>The <a class="reference internal" href="../library/pdb.html#module-pdb" title="pdb: The Python debugger for interactive interpreters."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pdb</span></code></a> module now supports remote attaching to a running Python process
using a new <a class="reference internal" href="../library/pdb.html#cmdoption-pdb-p"><code class="xref std std-option docutils literal notranslate"><span class="pre">-p</span> <span class="pre">PID</span></code></a> command-line option:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>python<span class="w"> </span>-m<span class="w"> </span>pdb<span class="w"> </span>-p<span class="w"> </span><span class="m">1234</span>
</pre></div>
</div>
<p>This will connect to the Python process with the given PID and allow you to
debug it interactively. Notice that due to how the Python interpreter works
attaching to a remote process that is blocked in a system call or waiting for
I/O will only work once the next bytecode instruction is executed or when the
process receives a signal.</p>
<p>This feature uses <a class="reference internal" href="#whatsnew314-remote-debugging"><span class="std std-ref">PEP 768</span></a>
and the new <a class="reference internal" href="../library/sys.html#sys.remote_exec" title="sys.remote_exec"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys.remote_exec()</span></code></a> function to attach to the remote process
and send the PDB commands to it.</p>
<p>(Contributed by Matt Wozniski and Pablo Galindo in <a class="reference external" href="https://github.com/python/cpython/issues/131591">gh-131591</a>.)</p>
</li>
<li><p>Hardcoded breakpoints (<a class="reference internal" href="../library/functions.html#breakpoint" title="breakpoint"><code class="xref py py-func docutils literal notranslate"><span class="pre">breakpoint()</span></code></a> and <a class="reference internal" href="../library/pdb.html#pdb.set_trace" title="pdb.set_trace"><code class="xref py py-func docutils literal notranslate"><span class="pre">set_trace()</span></code></a>) now
reuse the most recent <a class="reference internal" href="../library/pdb.html#pdb.Pdb" title="pdb.Pdb"><code class="xref py py-class docutils literal notranslate"><span class="pre">Pdb</span></code></a> instance that calls
<a class="reference internal" href="../library/pdb.html#pdb.Pdb.set_trace" title="pdb.Pdb.set_trace"><code class="xref py py-meth docutils literal notranslate"><span class="pre">set_trace()</span></code></a>, instead of creating a new one each time.
As a result, all the instance specific data like <a class="reference internal" href="../library/pdb.html#pdbcommand-display"><code class="xref std std-pdbcmd docutils literal notranslate"><span class="pre">display</span></code></a> and
<a class="reference internal" href="../library/pdb.html#pdbcommand-commands"><code class="xref std std-pdbcmd docutils literal notranslate"><span class="pre">commands</span></code></a> are preserved across hardcoded breakpoints.
(Contributed by Tian Gao in <a class="reference external" href="https://github.com/python/cpython/issues/121450">gh-121450</a>.)</p></li>
<li><p>Add a new argument <em>mode</em> to <a class="reference internal" href="../library/pdb.html#pdb.Pdb" title="pdb.Pdb"><code class="xref py py-class docutils literal notranslate"><span class="pre">pdb.Pdb</span></code></a>. Disable the <code class="docutils literal notranslate"><span class="pre">restart</span></code>
command when <a class="reference internal" href="../library/pdb.html#module-pdb" title="pdb: The Python debugger for interactive interpreters."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pdb</span></code></a> is in <code class="docutils literal notranslate"><span class="pre">inline</span></code> mode.
(Contributed by Tian Gao in <a class="reference external" href="https://github.com/python/cpython/issues/123757">gh-123757</a>.)</p></li>
<li><p>A confirmation prompt will be shown when the user tries to quit <a class="reference internal" href="../library/pdb.html#module-pdb" title="pdb: The Python debugger for interactive interpreters."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pdb</span></code></a>
in <code class="docutils literal notranslate"><span class="pre">inline</span></code> mode. <code class="docutils literal notranslate"><span class="pre">y</span></code>, <code class="docutils literal notranslate"><span class="pre">Y</span></code>, <code class="docutils literal notranslate"><span class="pre"><Enter></span></code> or <code class="docutils literal notranslate"><span class="pre">EOF</span></code> will confirm
the quit and call <a class="reference internal" href="../library/sys.html#sys.exit" title="sys.exit"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys.exit()</span></code></a>, instead of raising <a class="reference internal" href="../library/bdb.html#bdb.BdbQuit" title="bdb.BdbQuit"><code class="xref py py-exc docutils literal notranslate"><span class="pre">bdb.BdbQuit</span></code></a>.
(Contributed by Tian Gao in <a class="reference external" href="https://github.com/python/cpython/issues/124704">gh-124704</a>.)</p></li>
<li><p>Inline breakpoints like <a class="reference internal" href="../library/functions.html#breakpoint" title="breakpoint"><code class="xref py py-func docutils literal notranslate"><span class="pre">breakpoint()</span></code></a> or <a class="reference internal" href="../library/pdb.html#pdb.set_trace" title="pdb.set_trace"><code class="xref py py-func docutils literal notranslate"><span class="pre">pdb.set_trace()</span></code></a> will
always stop the program at calling frame, ignoring the <code class="docutils literal notranslate"><span class="pre">skip</span></code> pattern
(if any).
(Contributed by Tian Gao in <a class="reference external" href="https://github.com/python/cpython/issues/130493">gh-130493</a>.)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre"><tab></span></code> at the beginning of the line in <a class="reference internal" href="../library/pdb.html#module-pdb" title="pdb: The Python debugger for interactive interpreters."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pdb</span></code></a> multi-line input will
fill in a 4-space indentation now, instead of inserting a <code class="docutils literal notranslate"><span class="pre">\t</span></code> character.
(Contributed by Tian Gao in <a class="reference external" href="https://github.com/python/cpython/issues/130471">gh-130471</a>.)</p></li>
<li><p>Auto-indent is introduced in <a class="reference internal" href="../library/pdb.html#module-pdb" title="pdb: The Python debugger for interactive interpreters."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pdb</span></code></a> multi-line input. It will either
keep the indentation of the last line or insert a 4-space indentation when
it detects a new code block.
(Contributed by Tian Gao in <a class="reference external" href="https://github.com/python/cpython/issues/133350">gh-133350</a>.)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">$_asynctask</span></code> is added to access the current asyncio task if applicable.
(Contributed by Tian Gao in <a class="reference external" href="https://github.com/python/cpython/issues/124367">gh-124367</a>.)</p></li>
<li><p><a class="reference internal" href="../library/pdb.html#pdb.set_trace_async" title="pdb.set_trace_async"><code class="xref py py-func docutils literal notranslate"><span class="pre">pdb.set_trace_async()</span></code></a> is added to support debugging asyncio
coroutines. <a class="reference internal" href="../reference/expressions.html#await"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">await</span></code></a> statements are supported with this
function.
(Contributed by Tian Gao in <a class="reference external" href="https://github.com/python/cpython/issues/132576">gh-132576</a>.)</p></li>
<li><p>Source code displayed in <a class="reference internal" href="../library/pdb.html#module-pdb" title="pdb: The Python debugger for interactive interpreters."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pdb</span></code></a> will be syntax-highlighted. This feature
can be controlled using the same methods as the default <a class="reference internal" href="../glossary.html#term-interactive"><span class="xref std std-term">interactive</span></a>
shell, in addition to the newly added <code class="docutils literal notranslate"><span class="pre">colorize</span></code> argument of <a class="reference internal" href="../library/pdb.html#pdb.Pdb" title="pdb.Pdb"><code class="xref py py-class docutils literal notranslate"><span class="pre">pdb.Pdb</span></code></a>.
(Contributed by Tian Gao and Łukasz Langa in <a class="reference external" href="https://github.com/python/cpython/issues/133355">gh-133355</a>.)</p></li>
</ul>
</section>
<section id="pickle">
<h3>pickle<a class="headerlink" href="#pickle" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Set the default protocol version on the <a class="reference internal" href="../library/pickle.html#module-pickle" title="pickle: Convert Python objects to streams of bytes and back."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pickle</span></code></a> module to 5.
For more details, see <a class="reference internal" href="../library/pickle.html#pickle-protocols"><span class="std std-ref">pickle protocols</span></a>.</p></li>
<li><p>Add exception notes for pickle serialization errors that allow
identifying the source of the error.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/122213">gh-122213</a>.)</p></li>
</ul>
</section>
<section id="platform">
<h3>platform<a class="headerlink" href="#platform" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add <a class="reference internal" href="../library/platform.html#platform.invalidate_caches" title="platform.invalidate_caches"><code class="xref py py-func docutils literal notranslate"><span class="pre">invalidate_caches()</span></code></a>, a function to invalidate
cached results in the <code class="xref py py-mod docutils literal notranslate"><span class="pre">platform</span></code> module.
(Contributed by Bénédikt Tran in <a class="reference external" href="https://github.com/python/cpython/issues/122549">gh-122549</a>.)</p></li>
</ul>
</section>
<section id="pydoc">
<h3>pydoc<a class="headerlink" href="#pydoc" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p><a class="reference internal" href="../glossary.html#term-annotation"><span class="xref std std-term">Annotations</span></a> in help output are now usually
displayed in a format closer to that in the original source.
(Contributed by Jelle Zijlstra in <a class="reference external" href="https://github.com/python/cpython/issues/101552">gh-101552</a>.)</p></li>
</ul>
</section>
<section id="re">
<h3>re<a class="headerlink" href="#re" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Support <code class="docutils literal notranslate"><span class="pre">\z</span></code> as a synonym for <code class="docutils literal notranslate"><span class="pre">\Z</span></code> in <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">regular</span> <span class="pre">expressions</span></code></a>.
It is interpreted unambiguously in many other regular expression engines,
unlike <code class="docutils literal notranslate"><span class="pre">\Z</span></code>, which has subtly different behavior.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/133306">gh-133306</a>.)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">\B</span></code> in <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">regular</span> <span class="pre">expression</span></code></a> now matches the empty input string,
meaning that it is now always the opposite of <code class="docutils literal notranslate"><span class="pre">\b</span></code>.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/124130">gh-124130</a>.)</p></li>
</ul>
</section>
<section id="socket">
<h3>socket<a class="headerlink" href="#socket" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Improve and fix support for Bluetooth sockets.</p>
<ul>
<li><p>Fix support of Bluetooth sockets on NetBSD and DragonFly BSD.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/132429">gh-132429</a>.)</p></li>
<li><p>Fix support for <a class="reference internal" href="../library/socket.html#socket.BTPROTO_HCI" title="socket.BTPROTO_HCI"><code class="xref py py-const docutils literal notranslate"><span class="pre">BTPROTO_HCI</span></code></a> on FreeBSD.
(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/111178">gh-111178</a>.)</p></li>
<li><p>Add support for <a class="reference internal" href="../library/socket.html#socket.BTPROTO_SCO" title="socket.BTPROTO_SCO"><code class="xref py py-const docutils literal notranslate"><span class="pre">BTPROTO_SCO</span></code></a> on FreeBSD.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/85302">gh-85302</a>.)</p></li>
<li><p>Add support for <em>cid</em> and <em>bdaddr_type</em> in the address for
<a class="reference internal" href="../library/socket.html#socket.BTPROTO_L2CAP" title="socket.BTPROTO_L2CAP"><code class="xref py py-const docutils literal notranslate"><span class="pre">BTPROTO_L2CAP</span></code></a> on FreeBSD.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/132429">gh-132429</a>.)</p></li>
<li><p>Add support for <em>channel</em> in the address for
<a class="reference internal" href="../library/socket.html#socket.BTPROTO_HCI" title="socket.BTPROTO_HCI"><code class="xref py py-const docutils literal notranslate"><span class="pre">BTPROTO_HCI</span></code></a> on Linux.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/70145">gh-70145</a>.)</p></li>
<li><p>Accept an integer as the address for
<a class="reference internal" href="../library/socket.html#socket.BTPROTO_HCI" title="socket.BTPROTO_HCI"><code class="xref py py-const docutils literal notranslate"><span class="pre">BTPROTO_HCI</span></code></a> on Linux.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/132099">gh-132099</a>.)</p></li>
<li><p>Return <em>cid</em> in <a class="reference internal" href="../library/socket.html#socket.socket.getsockname" title="socket.socket.getsockname"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getsockname()</span></code></a> for
<a class="reference internal" href="../library/socket.html#socket.BTPROTO_L2CAP" title="socket.BTPROTO_L2CAP"><code class="xref py py-const docutils literal notranslate"><span class="pre">BTPROTO_L2CAP</span></code></a>.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/132429">gh-132429</a>.)</p></li>
<li><p>Add many new constants.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/132734">gh-132734</a>.)</p></li>
</ul>
</li>
</ul>
</section>
<section id="ssl">
<h3>ssl<a class="headerlink" href="#ssl" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Indicate through the <a class="reference internal" href="../library/ssl.html#ssl.HAS_PHA" title="ssl.HAS_PHA"><code class="xref py py-data docutils literal notranslate"><span class="pre">HAS_PHA</span></code></a> Boolean whether the <code class="xref py py-mod docutils literal notranslate"><span class="pre">ssl</span></code>
module supports TLSv1.3 post-handshake client authentication (PHA).
(Contributed by Will Childs-Klein in <a class="reference external" href="https://github.com/python/cpython/issues/128036">gh-128036</a>.)</p></li>
</ul>
</section>
<section id="struct">
<h3>struct<a class="headerlink" href="#struct" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Support the <span class="c-expr sig sig-inline c"><span class="kt">float</span><span class="w"> </span><span class="kt">complex</span></span> and <span class="c-expr sig sig-inline c"><span class="kt">double</span><span class="w"> </span><span class="kt">complex</span></span> C types in
the <a class="reference internal" href="../library/struct.html#module-struct" title="struct: Interpret bytes as packed binary data."><code class="xref py py-mod docutils literal notranslate"><span class="pre">struct</span></code></a> module (formatting characters <code class="docutils literal notranslate"><span class="pre">'F'</span></code> and <code class="docutils literal notranslate"><span class="pre">'D'</span></code>
respectively).
(Contributed by Sergey B Kirpichev in <a class="reference external" href="https://github.com/python/cpython/issues/121249">gh-121249</a>.)</p></li>
</ul>
</section>
<section id="symtable">
<h3>symtable<a class="headerlink" href="#symtable" title="Link to this heading">¶</a></h3>
<ul>
<li><p>Expose the following <a class="reference internal" href="../library/symtable.html#symtable.Symbol" title="symtable.Symbol"><code class="xref py py-class docutils literal notranslate"><span class="pre">Symbol</span></code></a> methods:</p>
<ul class="simple">
<li><p><a class="reference internal" href="../library/symtable.html#symtable.Symbol.is_comp_cell" title="symtable.Symbol.is_comp_cell"><code class="xref py py-meth docutils literal notranslate"><span class="pre">is_comp_cell()</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/symtable.html#symtable.Symbol.is_comp_iter" title="symtable.Symbol.is_comp_iter"><code class="xref py py-meth docutils literal notranslate"><span class="pre">is_comp_iter()</span></code></a></p></li>
<li><p><a class="reference internal" href="../library/symtable.html#symtable.Symbol.is_free_class" title="symtable.Symbol.is_free_class"><code class="xref py py-meth docutils literal notranslate"><span class="pre">is_free_class()</span></code></a></p></li>
</ul>
<p>(Contributed by Bénédikt Tran in <a class="reference external" href="https://github.com/python/cpython/issues/120029">gh-120029</a>.)</p>
</li>
</ul>
</section>
<section id="sys">
<h3>sys<a class="headerlink" href="#sys" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>The previously undocumented special function <a class="reference internal" href="../library/sys.html#sys.getobjects" title="sys.getobjects"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys.getobjects()</span></code></a>,
which only exists in specialized builds of Python, may now return objects
from other interpreters than the one it’s called in.
(Contributed by Eric Snow in <a class="reference external" href="https://github.com/python/cpython/issues/125286">gh-125286</a>.)</p></li>
<li><p>Add <a class="reference internal" href="../library/sys.html#sys._is_immortal" title="sys._is_immortal"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys._is_immortal()</span></code></a> for determining if an object is <a class="reference internal" href="../glossary.html#term-immortal"><span class="xref std std-term">immortal</span></a>.
(Contributed by Peter Bierma in <a class="reference external" href="https://github.com/python/cpython/issues/128509">gh-128509</a>.)</p></li>
<li><p>On FreeBSD, <a class="reference internal" href="../library/sys.html#sys.platform" title="sys.platform"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.platform</span></code></a> no longer contains the major version number.
It is always <code class="docutils literal notranslate"><span class="pre">'freebsd'</span></code>, instead of <code class="docutils literal notranslate"><span class="pre">'freebsd13'</span></code> or <code class="docutils literal notranslate"><span class="pre">'freebsd14'</span></code>.
(Contributed by Michael Osipov in <a class="reference external" href="https://github.com/python/cpython/issues/129393">gh-129393</a>.)</p></li>
<li><p>Raise <a class="reference internal" href="../library/exceptions.html#DeprecationWarning" title="DeprecationWarning"><code class="xref py py-exc docutils literal notranslate"><span class="pre">DeprecationWarning</span></code></a> for <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>. This
function was deprecated in Python 3.13 but it didn’t raise a runtime warning.</p></li>
<li><p>Add <a class="reference internal" href="../library/sys.html#sys.remote_exec" title="sys.remote_exec"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys.remote_exec()</span></code></a> to implement the new external debugger interface.
See <a class="reference internal" href="#whatsnew314-remote-debugging"><span class="std std-ref">PEP 768</span></a> for details.
(Contributed by Pablo Galindo Salgado, Matt Wozniski, and Ivona Stojanovic
in <a class="reference external" href="https://github.com/python/cpython/issues/131591">gh-131591</a>.)</p></li>
<li><p>Add the <a class="reference internal" href="../library/sys.html#sys._jit" title="sys._jit"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys._jit</span></code></a> namespace, containing utilities for introspecting
just-in-time compilation.
(Contributed by Brandt Bucher in <a class="reference external" href="https://github.com/python/cpython/issues/133231">gh-133231</a>.)</p></li>
</ul>
</section>
<section id="sys-monitoring">
<h3>sys.monitoring<a class="headerlink" href="#sys-monitoring" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add two new monitoring events, <a class="reference internal" href="../library/sys.monitoring.html#monitoring-event-BRANCH_LEFT"><code class="xref std std-monitoring-event docutils literal notranslate"><span class="pre">BRANCH_LEFT</span></code></a> and
<a class="reference internal" href="../library/sys.monitoring.html#monitoring-event-BRANCH_RIGHT"><code class="xref std std-monitoring-event docutils literal notranslate"><span class="pre">BRANCH_RIGHT</span></code></a>.
These replace and deprecate the <code class="xref std std-monitoring-event docutils literal notranslate"><span class="pre">BRANCH</span></code> event.
(Contributed by Mark Shannon in <a class="reference external" href="https://github.com/python/cpython/issues/122548">gh-122548</a>.)</p></li>
</ul>
</section>
<section id="sysconfig">
<h3>sysconfig<a class="headerlink" href="#sysconfig" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add <code class="docutils literal notranslate"><span class="pre">ABIFLAGS</span></code> key to <a class="reference internal" href="../library/sysconfig.html#sysconfig.get_config_vars" title="sysconfig.get_config_vars"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_config_vars()</span></code></a> on Windows.
(Contributed by Xuehai Pan in <a class="reference external" href="https://github.com/python/cpython/issues/131799">gh-131799</a>.)</p></li>
</ul>
</section>
<section id="tarfile">
<h3>tarfile<a class="headerlink" href="#tarfile" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p><a class="reference internal" href="../library/tarfile.html#tarfile.data_filter" title="tarfile.data_filter"><code class="xref py py-func docutils literal notranslate"><span class="pre">data_filter()</span></code></a> now normalizes symbolic link targets in order to
avoid path traversal attacks.
(Contributed by Petr Viktorin in <a class="reference external" href="https://github.com/python/cpython/issues/127987">gh-127987</a> and <span class="target" id="index-53"></span><a class="cve reference external" href="https://www.cve.org/CVERecord?id=CVE-2025-4138"><strong>CVE 2025-4138</strong></a>.)</p></li>
<li><p><a class="reference internal" href="../library/tarfile.html#tarfile.TarFile.extractall" title="tarfile.TarFile.extractall"><code class="xref py py-func docutils literal notranslate"><span class="pre">extractall()</span></code></a> now skips fixing up directory attributes
when a directory was removed or replaced by another kind of file.
(Contributed by Petr Viktorin in <a class="reference external" href="https://github.com/python/cpython/issues/127987">gh-127987</a> and <span class="target" id="index-54"></span><a class="cve reference external" href="https://www.cve.org/CVERecord?id=CVE-2024-12718"><strong>CVE 2024-12718</strong></a>.)</p></li>
<li><p><a class="reference internal" href="../library/tarfile.html#tarfile.TarFile.extract" title="tarfile.TarFile.extract"><code class="xref py py-func docutils literal notranslate"><span class="pre">extract()</span></code></a> and <a class="reference internal" href="../library/tarfile.html#tarfile.TarFile.extractall" title="tarfile.TarFile.extractall"><code class="xref py py-func docutils literal notranslate"><span class="pre">extractall()</span></code></a>
now (re-)apply the extraction filter when substituting a link (hard or
symbolic) with a copy of another archive member, and when fixing up
directory attributes.
The former raises a new exception, <a class="reference internal" href="../library/tarfile.html#tarfile.LinkFallbackError" title="tarfile.LinkFallbackError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">LinkFallbackError</span></code></a>.
(Contributed by Petr Viktorin for <span class="target" id="index-55"></span><a class="cve reference external" href="https://www.cve.org/CVERecord?id=CVE-2025-4330"><strong>CVE 2025-4330</strong></a> and <span class="target" id="index-56"></span><a class="cve reference external" href="https://www.cve.org/CVERecord?id=CVE-2024-12718"><strong>CVE 2024-12718</strong></a>.)</p></li>
<li><p><a class="reference internal" href="../library/tarfile.html#tarfile.TarFile.extract" title="tarfile.TarFile.extract"><code class="xref py py-func docutils literal notranslate"><span class="pre">extract()</span></code></a> and <a class="reference internal" href="../library/tarfile.html#tarfile.TarFile.extractall" title="tarfile.TarFile.extractall"><code class="xref py py-func docutils literal notranslate"><span class="pre">extractall()</span></code></a>
no longer extract rejected members when
<a class="reference internal" href="../library/tarfile.html#tarfile.TarFile.errorlevel" title="tarfile.TarFile.errorlevel"><code class="xref py py-func docutils literal notranslate"><span class="pre">errorlevel()</span></code></a> is zero.
(Contributed by Matt Prodani and Petr Viktorin in <a class="reference external" href="https://github.com/python/cpython/issues/112887">gh-112887</a>
and <span class="target" id="index-57"></span><a class="cve reference external" href="https://www.cve.org/CVERecord?id=CVE-2025-4435"><strong>CVE 2025-4435</strong></a>.)</p></li>
</ul>
</section>
<section id="threading">
<h3>threading<a class="headerlink" href="#threading" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p><a class="reference internal" href="../library/threading.html#threading.Thread.start" title="threading.Thread.start"><code class="xref py py-meth docutils literal notranslate"><span class="pre">threading.Thread.start()</span></code></a> now sets the operating system thread name
to <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>.
(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/59705">gh-59705</a>.)</p></li>
</ul>
</section>
<section id="tkinter">
<h3>tkinter<a class="headerlink" href="#tkinter" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Make <a class="reference internal" href="../library/tkinter.html#module-tkinter" title="tkinter: Interface to Tcl/Tk for graphical user interfaces"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tkinter</span></code></a> widget methods <code class="xref py py-meth docutils literal notranslate"><span class="pre">after()</span></code> and <code class="xref py py-meth docutils literal notranslate"><span class="pre">after_idle()</span></code>
accept keyword arguments.
(Contributed by Zhikang Yan in <a class="reference external" href="https://github.com/python/cpython/issues/126899">gh-126899</a>.)</p></li>
<li><p>Add ability to specify a name for <code class="xref py py-class docutils literal notranslate"><span class="pre">tkinter.OptionMenu</span></code> and
<code class="xref py py-class docutils literal notranslate"><span class="pre">tkinter.ttk.OptionMenu</span></code>.
(Contributed by Zhikang Yan in <a class="reference external" href="https://github.com/python/cpython/issues/130482">gh-130482</a>.)</p></li>
</ul>
</section>
<section id="turtle">
<h3>turtle<a class="headerlink" href="#turtle" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add context managers for <a class="reference internal" href="../library/turtle.html#turtle.fill" title="turtle.fill"><code class="xref py py-func docutils literal notranslate"><span class="pre">turtle.fill()</span></code></a>, <a class="reference internal" href="../library/turtle.html#turtle.poly" title="turtle.poly"><code class="xref py py-func docutils literal notranslate"><span class="pre">turtle.poly()</span></code></a>,
and <a class="reference internal" href="../library/turtle.html#turtle.no_animation" title="turtle.no_animation"><code class="xref py py-func docutils literal notranslate"><span class="pre">turtle.no_animation()</span></code></a>.
(Contributed by Marie Roald and Yngve Mardal Moe in <a class="reference external" href="https://github.com/python/cpython/issues/126350">gh-126350</a>.)</p></li>
</ul>
</section>
<section id="types">
<h3>types<a class="headerlink" href="#types" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p><a class="reference internal" href="../library/types.html#types.UnionType" title="types.UnionType"><code class="xref py py-class docutils literal notranslate"><span class="pre">types.UnionType</span></code></a> is now an alias for <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>.
See <a class="reference internal" href="#whatsnew314-typing-union"><span class="std std-ref">below</span></a> for more details.
(Contributed by Jelle Zijlstra in <a class="reference external" href="https://github.com/python/cpython/issues/105499">gh-105499</a>.)</p></li>
</ul>
</section>
<section id="typing">
<h3>typing<a class="headerlink" href="#typing" title="Link to this heading">¶</a></h3>
<ul id="whatsnew314-typing-union">
<li><p>The <a class="reference internal" href="../library/types.html#types.UnionType" title="types.UnionType"><code class="xref py py-class docutils literal notranslate"><span class="pre">types.UnionType</span></code></a> and <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> types are now
aliases for each other, meaning that both old-style unions
(created with <code class="docutils literal notranslate"><span class="pre">Union[int,</span> <span class="pre">str]</span></code>) and new-style unions (<code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">|</span> <span class="pre">str</span></code>)
now create instances of the same runtime type. This unifies the behavior
between the two syntaxes, but leads to some differences in behavior that
may affect users who introspect types at runtime:</p>
<ul class="simple">
<li><p>Both syntaxes for creating a union now produce the same string
representation in <a class="reference internal" href="../library/functions.html#repr" title="repr"><code class="xref py py-func docutils literal notranslate"><span class="pre">repr()</span></code></a>.
For example, <code class="docutils literal notranslate"><span class="pre">repr(Union[int,</span> <span class="pre">str])</span></code> is now <code class="docutils literal notranslate"><span class="pre">"int</span> <span class="pre">|</span> <span class="pre">str"</span></code> instead of
<code class="docutils literal notranslate"><span class="pre">"typing.Union[int,</span> <span class="pre">str]"</span></code>.</p></li>
<li><p>Unions created using the old syntax are no longer cached.
Previously, running <code class="docutils literal notranslate"><span class="pre">Union[int,</span> <span class="pre">str]</span></code> multiple times would return
the same object (<code class="docutils literal notranslate"><span class="pre">Union[int,</span> <span class="pre">str]</span> <span class="pre">is</span> <span class="pre">Union[int,</span> <span class="pre">str]</span></code> would be <code class="docutils literal notranslate"><span class="pre">True</span></code>),
but now it will return two different objects.
Use <code class="docutils literal notranslate"><span class="pre">==</span></code> to compare unions for equality, not <code class="docutils literal notranslate"><span class="pre">is</span></code>.
New-style unions have never been cached this way.
This change could increase memory usage for some programs that use
a large number of unions created by subscripting <code class="docutils literal notranslate"><span class="pre">typing.Union</span></code>.
However, several factors offset this cost:
unions used in annotations are no longer evaluated by default in Python
3.14 because of <span class="target" id="index-58"></span><a class="pep reference external" href="https://peps.python.org/pep-0649/"><strong>PEP 649</strong></a>; an instance of <a class="reference internal" href="../library/types.html#types.UnionType" title="types.UnionType"><code class="xref py py-class docutils literal notranslate"><span class="pre">types.UnionType</span></code></a> is
itself much smaller than the object returned by <code class="docutils literal notranslate"><span class="pre">Union[]</span></code> was on prior
Python versions; and removing the cache also saves some space.
It is therefore unlikely that this change will cause a significant increase
in memory usage for most users.</p></li>
<li><p>Previously, 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">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>It is now possible to use <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> itself in
<a class="reference internal" href="../library/functions.html#isinstance" title="isinstance"><code class="xref py py-func docutils literal notranslate"><span class="pre">isinstance()</span></code></a> checks.
For example, <code class="docutils literal notranslate"><span class="pre">isinstance(int</span> <span class="pre">|</span> <span class="pre">str,</span> <span class="pre">typing.Union)</span></code> will return <code class="docutils literal notranslate"><span class="pre">True</span></code>;
previously this raised <a class="reference internal" href="../library/exceptions.html#TypeError" title="TypeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code></a>.</p></li>
<li><p>The <code class="xref py py-attr docutils literal notranslate"><span class="pre">__args__</span></code> attribute of <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> objects is
no longer writable.</p></li>
<li><p>It is no longer possible to set any attributes on <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">Union</span></code></a>
objects.
This only ever worked for dunder attributes on previous versions, was never
documented to work, and was subtly broken in many cases.</p></li>
</ul>
<p>(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/typing.html#typing.TypeAliasType" title="typing.TypeAliasType"><code class="xref py py-class docutils literal notranslate"><span class="pre">TypeAliasType</span></code></a> now supports star unpacking.</p></li>
</ul>
</section>
<section id="unicodedata">
<h3>unicodedata<a class="headerlink" href="#unicodedata" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>The Unicode database has been updated to Unicode 16.0.0.</p></li>
</ul>
</section>
<section id="unittest">
<h3>unittest<a class="headerlink" href="#unittest" title="Link to this heading">¶</a></h3>
<ul id="whatsnew314-color-unittest">
<li><p><a class="reference internal" href="../library/unittest.html#module-unittest" title="unittest: Unit testing framework for Python."><code class="xref py py-mod docutils literal notranslate"><span class="pre">unittest</span></code></a> output is now colored by default.
This can be controlled by <a class="reference internal" href="../using/cmdline.html#using-on-controlling-color"><span class="std std-ref">environment variables</span></a>.
(Contributed by Hugo van Kemenade in <a class="reference external" href="https://github.com/python/cpython/issues/127221">gh-127221</a>.)</p></li>
<li><p>unittest discovery supports <a class="reference internal" href="../glossary.html#term-namespace-package"><span class="xref std std-term">namespace package</span></a> as start
directory again. It was removed in Python 3.11.
(Contributed by Jacob Walls in <a class="reference external" href="https://github.com/python/cpython/issues/80958">gh-80958</a>.)</p></li>
<li><p>A number of new methods were added in the <a class="reference internal" href="../library/unittest.html#unittest.TestCase" title="unittest.TestCase"><code class="xref py py-class docutils literal notranslate"><span class="pre">TestCase</span></code></a> class
that provide more specialized tests.</p>
<ul class="simple">
<li><p><a class="reference internal" href="../library/unittest.html#unittest.TestCase.assertHasAttr" title="unittest.TestCase.assertHasAttr"><code class="xref py py-meth docutils literal notranslate"><span class="pre">assertHasAttr()</span></code></a> and
<a class="reference internal" href="../library/unittest.html#unittest.TestCase.assertNotHasAttr" title="unittest.TestCase.assertNotHasAttr"><code class="xref py py-meth docutils literal notranslate"><span class="pre">assertNotHasAttr()</span></code></a> check whether the object
has a particular attribute.</p></li>
<li><p><a class="reference internal" href="../library/unittest.html#unittest.TestCase.assertIsSubclass" title="unittest.TestCase.assertIsSubclass"><code class="xref py py-meth docutils literal notranslate"><span class="pre">assertIsSubclass()</span></code></a> and
<a class="reference internal" href="../library/unittest.html#unittest.TestCase.assertNotIsSubclass" title="unittest.TestCase.assertNotIsSubclass"><code class="xref py py-meth docutils literal notranslate"><span class="pre">assertNotIsSubclass()</span></code></a> check whether the object
is a subclass of a particular class, or of one of a tuple of classes.</p></li>
<li><p><a class="reference internal" href="../library/unittest.html#unittest.TestCase.assertStartsWith" title="unittest.TestCase.assertStartsWith"><code class="xref py py-meth docutils literal notranslate"><span class="pre">assertStartsWith()</span></code></a>,
<a class="reference internal" href="../library/unittest.html#unittest.TestCase.assertNotStartsWith" title="unittest.TestCase.assertNotStartsWith"><code class="xref py py-meth docutils literal notranslate"><span class="pre">assertNotStartsWith()</span></code></a>,
<a class="reference internal" href="../library/unittest.html#unittest.TestCase.assertEndsWith" title="unittest.TestCase.assertEndsWith"><code class="xref py py-meth docutils literal notranslate"><span class="pre">assertEndsWith()</span></code></a> and
<a class="reference internal" href="../library/unittest.html#unittest.TestCase.assertNotEndsWith" title="unittest.TestCase.assertNotEndsWith"><code class="xref py py-meth docutils literal notranslate"><span class="pre">assertNotEndsWith()</span></code></a> check whether the Unicode
or byte string starts or ends with particular strings.</p></li>
</ul>
<p>(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/71339">gh-71339</a>.)</p>
</li>
</ul>
</section>
<section id="urllib">
<h3>urllib<a class="headerlink" href="#urllib" title="Link to this heading">¶</a></h3>
<ul>
<li><p>Upgrade HTTP digest authentication algorithm for <a class="reference internal" href="../library/urllib.request.html#module-urllib.request" title="urllib.request: Extensible library for opening URLs."><code class="xref py py-mod docutils literal notranslate"><span class="pre">urllib.request</span></code></a> by
supporting SHA-256 digest authentication as specified in <span class="target" id="index-59"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc7616.html"><strong>RFC 7616</strong></a>.
(Contributed by Calvin Bui in <a class="reference external" href="https://github.com/python/cpython/issues/128193">gh-128193</a>.)</p></li>
<li><p>Improve ergonomics and standards compliance when parsing and emitting
<code class="docutils literal notranslate"><span class="pre">file:</span></code> URLs.</p>
<p>In <a class="reference internal" href="../library/urllib.request.html#urllib.request.url2pathname" title="urllib.request.url2pathname"><code class="xref py py-func docutils literal notranslate"><span class="pre">url2pathname()</span></code></a>:</p>
<ul class="simple">
<li><p>Accept a complete URL when the new <em>require_scheme</em> argument is set to
true.</p></li>
<li><p>Discard URL authority if it matches the local hostname.</p></li>
<li><p>Discard URL authority if it resolves to a local IP address when the new
<em>resolve_host</em> argument is set to true.</p></li>
<li><p>Discard URL query and fragment components.</p></li>
<li><p>Raise <a class="reference internal" href="../library/urllib.error.html#urllib.error.URLError" title="urllib.error.URLError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">URLError</span></code></a> if a URL authority isn’t local,
except on Windows where we return a UNC path as before.</p></li>
</ul>
<p>In <a class="reference internal" href="../library/urllib.request.html#urllib.request.pathname2url" title="urllib.request.pathname2url"><code class="xref py py-func docutils literal notranslate"><span class="pre">pathname2url()</span></code></a>:</p>
<ul class="simple">
<li><p>Return a complete URL when the new <em>add_scheme</em> argument is set to true.</p></li>
<li><p>Include an empty URL authority when a path begins with a slash. For
example, the path <code class="docutils literal notranslate"><span class="pre">/etc/hosts</span></code> is converted to the URL <code class="docutils literal notranslate"><span class="pre">///etc/hosts</span></code>.</p></li>
</ul>
<p>On Windows, drive letters are no longer converted to uppercase, and <code class="docutils literal notranslate"><span class="pre">:</span></code>
characters not following a drive letter no longer cause an <a class="reference internal" href="../library/exceptions.html#OSError" title="OSError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">OSError</span></code></a>
exception to be raised.</p>
<p>(Contributed by Barney Gale in <a class="reference external" href="https://github.com/python/cpython/issues/125866">gh-125866</a>.)</p>
</li>
</ul>
</section>
<section id="uuid">
<h3>uuid<a class="headerlink" href="#uuid" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add support for UUID versions 6, 7, and 8 via <a class="reference internal" href="../library/uuid.html#uuid.uuid6" title="uuid.uuid6"><code class="xref py py-func docutils literal notranslate"><span class="pre">uuid6()</span></code></a>,
<a class="reference internal" href="../library/uuid.html#uuid.uuid7" title="uuid.uuid7"><code class="xref py py-func docutils literal notranslate"><span class="pre">uuid7()</span></code></a>, and <a class="reference internal" href="../library/uuid.html#uuid.uuid8" title="uuid.uuid8"><code class="xref py py-func docutils literal notranslate"><span class="pre">uuid8()</span></code></a> respectively, as specified
in <span class="target" id="index-60"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9562.html"><strong>RFC 9562</strong></a>.
(Contributed by Bénédikt Tran in <a class="reference external" href="https://github.com/python/cpython/issues/89083">gh-89083</a>.)</p></li>
<li><p><a class="reference internal" href="../library/uuid.html#uuid.NIL" title="uuid.NIL"><code class="xref py py-const docutils literal notranslate"><span class="pre">NIL</span></code></a> and <a class="reference internal" href="../library/uuid.html#uuid.MAX" title="uuid.MAX"><code class="xref py py-const docutils literal notranslate"><span class="pre">MAX</span></code></a> are now available to represent the
Nil and Max UUID formats as defined by <span class="target" id="index-61"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9562.html"><strong>RFC 9562</strong></a>.
(Contributed by Nick Pope in <a class="reference external" href="https://github.com/python/cpython/issues/128427">gh-128427</a>.)</p></li>
<li><p>Allow generating multiple UUIDs simultaneously on the command-line via
<a class="reference internal" href="../library/uuid.html#cmdoption-uuid-count"><code class="xref std std-option docutils literal notranslate"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">uuid</span> <span class="pre">--count</span></code></a>.
(Contributed by Simon Legner in <a class="reference external" href="https://github.com/python/cpython/issues/131236">gh-131236</a>.)</p></li>
</ul>
</section>
<section id="webbrowser">
<h3>webbrowser<a class="headerlink" href="#webbrowser" title="Link to this heading">¶</a></h3>
<ul>
<li><p>Names in the <span class="target" id="index-62"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">BROWSER</span></code> environment variable can now refer to already
registered browsers for the <a class="reference internal" href="../library/webbrowser.html#module-webbrowser" title="webbrowser: Easy-to-use controller for web browsers."><code class="xref py py-mod docutils literal notranslate"><span class="pre">webbrowser</span></code></a> module, instead of always
generating a new browser command.</p>
<p>This makes it possible to set <span class="target" id="index-63"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">BROWSER</span></code> to the value of one of the
supported browsers on macOS.</p>
</li>
</ul>
</section>
<section id="zipfile">
<h3>zipfile<a class="headerlink" href="#zipfile" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Added <a class="reference internal" href="../library/zipfile.html#zipfile.ZipInfo._for_archive" title="zipfile.ZipInfo._for_archive"><code class="xref py py-meth docutils literal notranslate"><span class="pre">ZipInfo._for_archive</span></code></a>, a method
to resolve suitable defaults for a <a class="reference internal" href="../library/zipfile.html#zipfile.ZipInfo" title="zipfile.ZipInfo"><code class="xref py py-class docutils literal notranslate"><span class="pre">ZipInfo</span></code></a> object
as used by <a class="reference internal" href="../library/zipfile.html#zipfile.ZipFile.writestr" title="zipfile.ZipFile.writestr"><code class="xref py py-func docutils literal notranslate"><span class="pre">ZipFile.writestr</span></code></a>.
(Contributed by Bénédikt Tran in <a class="reference external" href="https://github.com/python/cpython/issues/123424">gh-123424</a>.)</p></li>
<li><p><a class="reference internal" href="../library/zipfile.html#zipfile.ZipFile.writestr" title="zipfile.ZipFile.writestr"><code class="xref py py-meth docutils literal notranslate"><span class="pre">ZipFile.writestr()</span></code></a> now respects the <span class="target" id="index-64"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">SOURCE_DATE_EPOCH</span></code>
environment variable in order to better support reproducible builds.
(Contributed by Jiahao Li in <a class="reference external" href="https://github.com/python/cpython/issues/91279">gh-91279</a>.)</p></li>
</ul>
</section>
</section>
<section id="optimizations">
<h2>Optimizations<a class="headerlink" href="#optimizations" title="Link to this heading">¶</a></h2>
<ul>
<li><p>The import time for several standard library modules has been improved,
including <a class="reference internal" href="../library/annotationlib.html#module-annotationlib" title="annotationlib: Functionality for introspecting annotations"><code class="xref py py-mod docutils literal notranslate"><span class="pre">annotationlib</span></code></a>, <a class="reference internal" href="../library/ast.html#module-ast" title="ast: Abstract Syntax Tree classes and manipulation."><code class="xref py py-mod docutils literal notranslate"><span class="pre">ast</span></code></a>, <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>, <a class="reference internal" href="../library/base64.html#module-base64" title="base64: RFC 4648: Base16, Base32, Base64 Data Encodings; Base85 and Ascii85"><code class="xref py py-mod docutils literal notranslate"><span class="pre">base64</span></code></a>,
<a class="reference internal" href="../library/cmd.html#module-cmd" title="cmd: Build line-oriented command interpreters."><code class="xref py py-mod docutils literal notranslate"><span class="pre">cmd</span></code></a>, <a class="reference internal" href="../library/csv.html#module-csv" title="csv: Write and read tabular data to and from delimited files."><code class="xref py py-mod docutils literal notranslate"><span class="pre">csv</span></code></a>, <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>, <a class="reference internal" href="../library/importlib.html#module-importlib.util" title="importlib.util: Utility code for importers"><code class="xref py py-mod docutils literal notranslate"><span class="pre">importlib.util</span></code></a>, <a class="reference internal" href="../library/locale.html#module-locale" title="locale: Internationalization services."><code class="xref py py-mod docutils literal notranslate"><span class="pre">locale</span></code></a>,
<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>, <a class="reference internal" href="../library/optparse.html#module-optparse" title="optparse: Command-line option parsing library."><code class="xref py py-mod docutils literal notranslate"><span class="pre">optparse</span></code></a>, <a class="reference internal" href="../library/pickle.html#module-pickle" title="pickle: Convert Python objects to streams of bytes and back."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pickle</span></code></a>, <a class="reference internal" href="../library/pprint.html#module-pprint" title="pprint: Data pretty printer."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pprint</span></code></a>,
<a class="reference internal" href="../library/profile.html#module-pstats" title="pstats: Statistics object for use with the profiler."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pstats</span></code></a>, <a class="reference internal" href="../library/shlex.html#module-shlex" title="shlex: Simple lexical analysis for Unix shell-like languages."><code class="xref py py-mod docutils literal notranslate"><span class="pre">shlex</span></code></a>, <a class="reference internal" href="../library/socket.html#module-socket" title="socket: Low-level networking interface."><code class="xref py py-mod docutils literal notranslate"><span class="pre">socket</span></code></a>, <a class="reference internal" href="../library/string.html#module-string" title="string: Common string operations."><code class="xref py py-mod docutils literal notranslate"><span class="pre">string</span></code></a>, <a class="reference internal" href="../library/subprocess.html#module-subprocess" title="subprocess: Subprocess management."><code class="xref py py-mod docutils literal notranslate"><span class="pre">subprocess</span></code></a>,
<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>, <a class="reference internal" href="../library/tomllib.html#module-tomllib" title="tomllib: Parse TOML files."><code class="xref py py-mod docutils literal notranslate"><span class="pre">tomllib</span></code></a>, <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>, and <a class="reference internal" href="../library/zipfile.html#module-zipfile" title="zipfile: Read and write ZIP-format archive files."><code class="xref py py-mod docutils literal notranslate"><span class="pre">zipfile</span></code></a>.</p>
<p>(Contributed by Adam Turner, Bénédikt Tran, Chris Markiewicz, Eli Schwartz,
Hugo van Kemenade, Jelle Zijlstra, and others in <a class="reference external" href="https://github.com/python/cpython/issues/118761">gh-118761</a>.)</p>
</li>
<li><p>The interpreter now avoids some reference count modifications internally
when it’s safe to do so.
This can lead to different values being returned from <a class="reference internal" href="../library/sys.html#sys.getrefcount" title="sys.getrefcount"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys.getrefcount()</span></code></a>
and <a class="reference internal" href="../c-api/refcounting.html#c.Py_REFCNT" title="Py_REFCNT"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_REFCNT()</span></code></a> compared to previous versions of Python.
See <a class="reference internal" href="#whatsnew314-refcount"><span class="std std-ref">below</span></a> for details.</p></li>
</ul>
<section id="id2">
<h3>asyncio<a class="headerlink" href="#id2" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Standard benchmark results have improved by 10-20% following the
implementation of a new per-thread doubly linked list
for <a class="reference internal" href="../library/asyncio-task.html#asyncio.Task" title="asyncio.Task"><code class="xref py py-class docutils literal notranslate"><span class="pre">native</span> <span class="pre">tasks</span></code></a>,
also reducing memory usage.
This enables external introspection tools such as
<a class="reference internal" href="#whatsnew314-asyncio-introspection"><span class="std std-ref">python -m asyncio pstree</span></a>
to introspect the call graph of asyncio tasks running in all threads.
(Contributed by Kumar Aditya in <a class="reference external" href="https://github.com/python/cpython/issues/107803">gh-107803</a>.)</p></li>
<li><p>The module now has first class support for
<a class="reference internal" href="../glossary.html#term-free-threading"><span class="xref std std-term">free-threading builds</span></a>.
This enables parallel execution of multiple event loops across
different threads, scaling linearly with the number of threads.
(Contributed by Kumar Aditya in <a class="reference external" href="https://github.com/python/cpython/issues/128002">gh-128002</a>.)</p></li>
</ul>
</section>
<section id="base64">
<h3>base64<a class="headerlink" href="#base64" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p><a class="reference internal" href="../library/base64.html#base64.b16decode" title="base64.b16decode"><code class="xref py py-func docutils literal notranslate"><span class="pre">b16decode()</span></code></a> is now up to six times faster.
(Contributed by Bénédikt Tran, Chris Markiewicz, and Adam Turner
in <a class="reference external" href="https://github.com/python/cpython/issues/118761">gh-118761</a>.)</p></li>
</ul>
</section>
<section id="bdb">
<h3>bdb<a class="headerlink" href="#bdb" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>The basic debugger now has a <a class="reference internal" href="../library/sys.monitoring.html#module-sys.monitoring" title="sys.monitoring: Access and control event monitoring"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sys.monitoring</span></code></a>-based backend,
which can be selected via the passing <code class="docutils literal notranslate"><span class="pre">'monitoring'</span></code>
to the <a class="reference internal" href="../library/bdb.html#bdb.Bdb" title="bdb.Bdb"><code class="xref py py-class docutils literal notranslate"><span class="pre">Bdb</span></code></a> class’s new <em>backend</em> parameter.
(Contributed by Tian Gao in <a class="reference external" href="https://github.com/python/cpython/issues/124533">gh-124533</a>.)</p></li>
</ul>
</section>
<section id="id3">
<h3>difflib<a class="headerlink" href="#id3" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>The <a class="reference internal" href="../library/difflib.html#difflib.IS_LINE_JUNK" title="difflib.IS_LINE_JUNK"><code class="xref py py-func docutils literal notranslate"><span class="pre">IS_LINE_JUNK()</span></code></a> function is now up to twice as fast.
(Contributed by Adam Turner and Semyon Moroz in <a class="reference external" href="https://github.com/python/cpython/issues/130167">gh-130167</a>.)</p></li>
</ul>
</section>
<section id="gc">
<h3>gc<a class="headerlink" href="#gc" title="Link to this heading">¶</a></h3>
<ul>
<li><p>The new <a class="reference internal" href="#whatsnew314-incremental-gc"><span class="std std-ref">incremental garbage collector</span></a>
means that maximum pause times are reduced
by an order of magnitude or more for larger heaps.</p>
<p>Because of this optimization, the meaning of the results of
<a class="reference internal" href="../library/gc.html#gc.get_threshold" title="gc.get_threshold"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_threshold()</span></code></a> and <a class="reference internal" href="../library/gc.html#gc.set_threshold" title="gc.set_threshold"><code class="xref py py-meth docutils literal notranslate"><span class="pre">set_threshold()</span></code></a> have changed,
along with <a class="reference internal" href="../library/gc.html#gc.get_count" title="gc.get_count"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_count()</span></code></a> and <a class="reference internal" href="../library/gc.html#gc.get_stats" title="gc.get_stats"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_stats()</span></code></a>.</p>
<ul class="simple">
<li><p>For backwards compatibility, <a class="reference internal" href="../library/gc.html#gc.get_threshold" title="gc.get_threshold"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_threshold()</span></code></a> continues to return
a three-item tuple.
The first value is the threshold for young collections, as before;
the second value determines the rate at which the old collection is scanned
(the default is 10, and higher values mean that the old collection
is scanned more slowly).
The third value is now meaningless and is always zero.</p></li>
<li><p><a class="reference internal" href="../library/gc.html#gc.set_threshold" title="gc.set_threshold"><code class="xref py py-meth docutils literal notranslate"><span class="pre">set_threshold()</span></code></a> now ignores any items after the second.</p></li>
<li><p><a class="reference internal" href="../library/gc.html#gc.get_count" title="gc.get_count"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_count()</span></code></a> and <a class="reference internal" href="../library/gc.html#gc.get_stats" title="gc.get_stats"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_stats()</span></code></a> continue to return
the same format of results.
The only difference is that instead of the results referring to
the young, aging and old generations,
the results refer to the young generation
and the aging and collecting spaces of the old generation.</p></li>
</ul>
<p>In summary, code that attempted to manipulate the behavior of the cycle GC
may not work exactly as intended, but it is very unlikely to be harmful.
All other code will work just fine.</p>
<p>(Contributed by Mark Shannon in <a class="reference external" href="https://github.com/python/cpython/issues/108362">gh-108362</a>.)</p>
</li>
</ul>
</section>
<section id="id4">
<h3>io<a class="headerlink" href="#id4" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Opening and reading files now executes fewer system calls.
Reading a small operating system cached file in full is up to 15% faster.
(Contributed by Cody Maloney and Victor Stinner
in <a class="reference external" href="https://github.com/python/cpython/issues/120754">gh-120754</a> and <a class="reference external" href="https://github.com/python/cpython/issues/90102">gh-90102</a>.)</p></li>
</ul>
</section>
<section id="id5">
<h3>pathlib<a class="headerlink" href="#id5" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p><a class="reference internal" href="../library/pathlib.html#pathlib.Path.read_bytes" title="pathlib.Path.read_bytes"><code class="xref py py-func docutils literal notranslate"><span class="pre">Path.read_bytes</span></code></a> now uses unbuffered mode
to open files, which is between 9% and 17% faster to read in full.
(Contributed by Cody Maloney in <a class="reference external" href="https://github.com/python/cpython/issues/120754">gh-120754</a>.)</p></li>
</ul>
</section>
<section id="id6">
<h3>pdb<a class="headerlink" href="#id6" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p><a class="reference internal" href="../library/pdb.html#module-pdb" title="pdb: The Python debugger for interactive interpreters."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pdb</span></code></a> now supports two backends, based on either
<a class="reference internal" href="../library/sys.html#sys.settrace" title="sys.settrace"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys.settrace()</span></code></a> or <a class="reference internal" href="../library/sys.monitoring.html#module-sys.monitoring" title="sys.monitoring: Access and control event monitoring"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sys.monitoring</span></code></a>.
Using the <a class="reference internal" href="../library/pdb.html#pdb-cli"><span class="std std-ref">pdb CLI</span></a> or <a class="reference internal" href="../library/functions.html#breakpoint" title="breakpoint"><code class="xref py py-func docutils literal notranslate"><span class="pre">breakpoint()</span></code></a>
will always use the <a class="reference internal" href="../library/sys.monitoring.html#module-sys.monitoring" title="sys.monitoring: Access and control event monitoring"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sys.monitoring</span></code></a> backend.
Explicitly instantiating <a class="reference internal" href="../library/pdb.html#pdb.Pdb" title="pdb.Pdb"><code class="xref py py-class docutils literal notranslate"><span class="pre">pdb.Pdb</span></code></a> and its derived classes
will use the <a class="reference internal" href="../library/sys.html#sys.settrace" title="sys.settrace"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys.settrace()</span></code></a> backend by default, which is configurable.
(Contributed by Tian Gao in <a class="reference external" href="https://github.com/python/cpython/issues/124533">gh-124533</a>.)</p></li>
</ul>
</section>
<section id="id7">
<h3>uuid<a class="headerlink" href="#id7" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p><a class="reference internal" href="../library/uuid.html#uuid.uuid3" title="uuid.uuid3"><code class="xref py py-func docutils literal notranslate"><span class="pre">uuid3()</span></code></a> and <a class="reference internal" href="../library/uuid.html#uuid.uuid5" title="uuid.uuid5"><code class="xref py py-func docutils literal notranslate"><span class="pre">uuid5()</span></code></a> are now both roughly 40% faster
for 16-byte names and 20% faster for 1024-byte names.
Performance for longer names remains unchanged.
(Contributed by Bénédikt Tran in <a class="reference external" href="https://github.com/python/cpython/issues/128150">gh-128150</a>.)</p></li>
<li><p><a class="reference internal" href="../library/uuid.html#uuid.uuid4" title="uuid.uuid4"><code class="xref py py-func docutils literal notranslate"><span class="pre">uuid4()</span></code></a> is now c. 30% faster.
(Contributed by Bénédikt Tran in <a class="reference external" href="https://github.com/python/cpython/issues/128150">gh-128150</a>.)</p></li>
</ul>
</section>
<section id="zlib">
<h3>zlib<a class="headerlink" href="#zlib" title="Link to this heading">¶</a></h3>
<ul>
<li><p>On Windows, <a class="reference external" href="https://github.com/zlib-ng/zlib-ng">zlib-ng</a>
is now used as the implementation of the <a class="reference internal" href="../library/zlib.html#module-zlib" title="zlib: Low-level interface to compression and decompression routines compatible with gzip."><code class="xref py py-mod docutils literal notranslate"><span class="pre">zlib</span></code></a> module
in the default binaries.
There are no known incompatibilities between <code class="docutils literal notranslate"><span class="pre">zlib-ng</span></code>
and the previously-used <code class="docutils literal notranslate"><span class="pre">zlib</span></code> implementation.
This should result in better performance at all compression levels.</p>
<p>It is worth noting that <code class="docutils literal notranslate"><span class="pre">zlib.Z_BEST_SPEED</span></code> (<code class="docutils literal notranslate"><span class="pre">1</span></code>) may result in
significantly less compression than the previous implementation,
whilst also significantly reducing the time taken to compress.</p>
<p>(Contributed by Steve Dower in <a class="reference external" href="https://github.com/python/cpython/issues/91349">gh-91349</a>.)</p>
</li>
</ul>
</section>
</section>
<section id="removed">
<h2>Removed<a class="headerlink" href="#removed" title="Link to this heading">¶</a></h2>
<section id="id8">
<h3>argparse<a class="headerlink" href="#id8" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Remove the <em>type</em>, <em>choices</em>, and <em>metavar</em> parameters
of <code class="xref py py-class docutils literal notranslate"><span class="pre">BooleanOptionalAction</span></code>.
These have been deprecated since Python 3.12.
(Contributed by Nikita Sobolev in <a class="reference external" href="https://github.com/python/cpython/issues/118805">gh-118805</a>.)</p></li>
<li><p>Calling <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>
on an argument group now raises 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>.
Similarly, <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>
or <a class="reference internal" href="../library/argparse.html#argparse.ArgumentParser.add_mutually_exclusive_group" title="argparse.ArgumentParser.add_mutually_exclusive_group"><code class="xref py py-meth docutils literal notranslate"><span class="pre">add_mutually_exclusive_group()</span></code></a>
on a mutually exclusive group now both raise <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>s.
This ‘nesting’ was never supported, often failed to work correctly,
and was unintentionally exposed through inheritance.
This functionality has been deprecated since Python 3.11.
(Contributed by Savannah Ostrowski in <a class="reference external" href="https://github.com/python/cpython/issues/127186">gh-127186</a>.)</p></li>
</ul>
</section>
<section id="id9">
<h3>ast<a class="headerlink" href="#id9" title="Link to this heading">¶</a></h3>
<ul>
<li><p>Remove the following classes, which have been deprecated aliases of
<a class="reference internal" href="../library/ast.html#ast.Constant" title="ast.Constant"><code class="xref py py-class docutils literal notranslate"><span class="pre">Constant</span></code></a> since Python 3.8 and have emitted
deprecation warnings since Python 3.12:</p>
<ul class="simple">
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Bytes</span></code></p></li>
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Ellipsis</span></code></p></li>
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">NameConstant</span></code></p></li>
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Num</span></code></p></li>
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Str</span></code></p></li>
</ul>
<p>As a consequence of these removals, user-defined <code class="docutils literal notranslate"><span class="pre">visit_Num</span></code>, <code class="docutils literal notranslate"><span class="pre">visit_Str</span></code>,
<code class="docutils literal notranslate"><span class="pre">visit_Bytes</span></code>, <code class="docutils literal notranslate"><span class="pre">visit_NameConstant</span></code> and <code class="docutils literal notranslate"><span class="pre">visit_Ellipsis</span></code> methods
on custom <a class="reference internal" href="../library/ast.html#ast.NodeVisitor" title="ast.NodeVisitor"><code class="xref py py-class docutils literal notranslate"><span class="pre">NodeVisitor</span></code></a> subclasses will no longer be called
when the <code class="xref py py-class docutils literal notranslate"><span class="pre">NodeVisitor</span></code> subclass is visiting an AST.
Define a <code class="docutils literal notranslate"><span class="pre">visit_Constant</span></code> method instead.</p>
<p>(Contributed by Alex Waygood in <a class="reference external" href="https://github.com/python/cpython/issues/119562">gh-119562</a>.)</p>
</li>
<li><p>Remove the following deprecated properties on <a class="reference internal" href="../library/ast.html#ast.Constant" title="ast.Constant"><code class="xref py py-class docutils literal notranslate"><span class="pre">ast.Constant</span></code></a>,
which were present for compatibility with the now-removed AST classes:</p>
<ul class="simple">
<li><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">Constant.n</span></code></p></li>
<li><p><code class="xref py py-attr docutils literal notranslate"><span class="pre">Constant.s</span></code></p></li>
</ul>
<p>Use <code class="xref py py-attr docutils literal notranslate"><span class="pre">Constant.value</span></code> instead.
(Contributed by Alex Waygood in <a class="reference external" href="https://github.com/python/cpython/issues/119562">gh-119562</a>.)</p>
</li>
</ul>
</section>
<section id="id10">
<h3>asyncio<a class="headerlink" href="#id10" title="Link to this heading">¶</a></h3>
<ul>
<li><p>Remove the following classes, methods, and functions,
which have been deprecated since Python 3.12:</p>
<ul class="simple">
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">AbstractChildWatcher</span></code></p></li>
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">FastChildWatcher</span></code></p></li>
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">MultiLoopChildWatcher</span></code></p></li>
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">PidfdChildWatcher</span></code></p></li>
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">SafeChildWatcher</span></code></p></li>
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ThreadedChildWatcher</span></code></p></li>
<li><p><code class="xref py py-meth docutils literal notranslate"><span class="pre">AbstractEventLoopPolicy.get_child_watcher()</span></code></p></li>
<li><p><code class="xref py py-meth docutils literal notranslate"><span class="pre">AbstractEventLoopPolicy.set_child_watcher()</span></code></p></li>
<li><p><code class="xref py py-func docutils literal notranslate"><span class="pre">get_child_watcher()</span></code></p></li>
<li><p><code class="xref py py-func docutils literal notranslate"><span class="pre">set_child_watcher()</span></code></p></li>
</ul>
<p>(Contributed by Kumar Aditya in <a class="reference external" href="https://github.com/python/cpython/issues/120804">gh-120804</a>.)</p>
</li>
<li><p><a class="reference internal" href="../library/asyncio-eventloop.html#asyncio.get_event_loop" title="asyncio.get_event_loop"><code class="xref py py-func docutils literal notranslate"><span class="pre">asyncio.get_event_loop()</span></code></a> now raises a <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>
if there is no current event loop,
and no longer implicitly creates an event loop.</p>
<p>(Contributed by Kumar Aditya in <a class="reference external" href="https://github.com/python/cpython/issues/126353">gh-126353</a>.)</p>
<p>There’s a few patterns that use <a class="reference internal" href="../library/asyncio-eventloop.html#asyncio.get_event_loop" title="asyncio.get_event_loop"><code class="xref py py-func docutils literal notranslate"><span class="pre">asyncio.get_event_loop()</span></code></a>, most
of them can be replaced with <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>.</p>
<p>If you’re running an async function, simply 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>.</p>
<p>Before:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></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">loop</span> <span class="o">=</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">get_event_loop</span><span class="p">()</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">loop</span><span class="o">.</span><span class="n">run_until_complete</span><span class="p">(</span><span class="n">main</span><span class="p">())</span>
<span class="k">finally</span><span class="p">:</span>
<span class="n">loop</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
<p>After:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></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>
</pre></div>
</div>
<p>If you need to start something, for example, a server listening on a socket
and then run forever, 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> and an
<a class="reference internal" href="../library/asyncio-sync.html#asyncio.Event" title="asyncio.Event"><code class="xref py py-class docutils literal notranslate"><span class="pre">asyncio.Event</span></code></a>.</p>
<p>Before:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span><span class="w"> </span><span class="nf">start_server</span><span class="p">(</span><span class="n">loop</span><span class="p">):</span> <span class="o">...</span>
<span class="n">loop</span> <span class="o">=</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">get_event_loop</span><span class="p">()</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">start_server</span><span class="p">(</span><span class="n">loop</span><span class="p">)</span>
<span class="n">loop</span><span class="o">.</span><span class="n">run_forever</span><span class="p">()</span>
<span class="k">finally</span><span class="p">:</span>
<span class="n">loop</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
<p>After:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span><span class="w"> </span><span class="nf">start_server</span><span class="p">(</span><span class="n">loop</span><span class="p">):</span> <span class="o">...</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="n">start_server</span><span class="p">(</span><span class="n">asyncio</span><span class="o">.</span><span class="n">get_running_loop</span><span class="p">())</span>
<span class="k">await</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">Event</span><span class="p">()</span><span class="o">.</span><span class="n">wait</span><span class="p">()</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>
</pre></div>
</div>
<p>If you need to run something in an event loop, then run some blocking
code around it, use <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>.</p>
<p>Before:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">def</span><span class="w"> </span><span class="nf">operation_one</span><span class="p">():</span> <span class="o">...</span>
<span class="k">def</span><span class="w"> </span><span class="nf">blocking_code</span><span class="p">():</span> <span class="o">...</span>
<span class="k">async</span> <span class="k">def</span><span class="w"> </span><span class="nf">operation_two</span><span class="p">():</span> <span class="o">...</span>
<span class="n">loop</span> <span class="o">=</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">get_event_loop</span><span class="p">()</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">loop</span><span class="o">.</span><span class="n">run_until_complete</span><span class="p">(</span><span class="n">operation_one</span><span class="p">())</span>
<span class="n">blocking_code</span><span class="p">()</span>
<span class="n">loop</span><span class="o">.</span><span class="n">run_until_complete</span><span class="p">(</span><span class="n">operation_two</span><span class="p">())</span>
<span class="k">finally</span><span class="p">:</span>
<span class="n">loop</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
<p>After:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">def</span><span class="w"> </span><span class="nf">operation_one</span><span class="p">():</span> <span class="o">...</span>
<span class="k">def</span><span class="w"> </span><span class="nf">blocking_code</span><span class="p">():</span> <span class="o">...</span>
<span class="k">async</span> <span class="k">def</span><span class="w"> </span><span class="nf">operation_two</span><span class="p">():</span> <span class="o">...</span>
<span class="k">with</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">Runner</span><span class="p">()</span> <span class="k">as</span> <span class="n">runner</span><span class="p">:</span>
<span class="n">runner</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">operation_one</span><span class="p">())</span>
<span class="n">blocking_code</span><span class="p">()</span>
<span class="n">runner</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">operation_two</span><span class="p">())</span>
</pre></div>
</div>
</li>
</ul>
</section>
<section id="email">
<h3>email<a class="headerlink" href="#email" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Remove <a class="reference internal" href="../library/email.utils.html#email.utils.localtime" title="email.utils.localtime"><code class="xref py py-func docutils literal notranslate"><span class="pre">email.utils.localtime()</span></code></a>’s <em>isdst</em> parameter,
which was deprecated in and has been ignored since Python 3.12.
(Contributed by Hugo van Kemenade in <a class="reference external" href="https://github.com/python/cpython/issues/118798">gh-118798</a>.)</p></li>
</ul>
</section>
<section id="importlib-abc">
<h3>importlib.abc<a class="headerlink" href="#importlib-abc" title="Link to this heading">¶</a></h3>
<ul>
<li><p>Remove deprecated <a class="reference internal" href="../library/importlib.html#module-importlib.abc" title="importlib.abc: Abstract base classes related to import"><code class="xref py py-mod docutils literal notranslate"><span class="pre">importlib.abc</span></code></a> classes:</p>
<ul class="simple">
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ResourceReader</span></code>
(use <a class="reference internal" href="../library/importlib.resources.abc.html#importlib.resources.abc.TraversableResources" title="importlib.resources.abc.TraversableResources"><code class="xref py py-class docutils literal notranslate"><span class="pre">TraversableResources</span></code></a>)</p></li>
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Traversable</span></code>
(use <a class="reference internal" href="../library/importlib.resources.abc.html#importlib.resources.abc.Traversable" title="importlib.resources.abc.Traversable"><code class="xref py py-class docutils literal notranslate"><span class="pre">Traversable</span></code></a>)</p></li>
<li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">TraversableResources</span></code>
(use <a class="reference internal" href="../library/importlib.resources.abc.html#importlib.resources.abc.TraversableResources" title="importlib.resources.abc.TraversableResources"><code class="xref py py-class docutils literal notranslate"><span class="pre">TraversableResources</span></code></a>)</p></li>
</ul>
<p>(Contributed by Jason R. Coombs and Hugo van Kemenade in <a class="reference external" href="https://github.com/python/cpython/issues/93963">gh-93963</a>.)</p>
</li>
</ul>
</section>
<section id="itertools">
<h3>itertools<a class="headerlink" href="#itertools" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Remove support for copy, deepcopy, and pickle operations
from <a class="reference internal" href="../library/itertools.html#module-itertools" title="itertools: Functions creating iterators for efficient looping."><code class="xref py py-mod docutils literal notranslate"><span class="pre">itertools</span></code></a> iterators.
These have emitted a <a class="reference internal" href="../library/exceptions.html#DeprecationWarning" title="DeprecationWarning"><code class="xref py py-exc docutils literal notranslate"><span class="pre">DeprecationWarning</span></code></a> since Python 3.12.
(Contributed by Raymond Hettinger in <a class="reference external" href="https://github.com/python/cpython/issues/101588">gh-101588</a>.)</p></li>
</ul>
</section>
<section id="id11">
<h3>pathlib<a class="headerlink" href="#id11" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Remove support for passing additional keyword arguments
to <a class="reference internal" href="../library/pathlib.html#pathlib.Path" title="pathlib.Path"><code class="xref py py-class docutils literal notranslate"><span class="pre">Path</span></code></a>.
In previous versions, any such arguments are ignored.
(Contributed by Barney Gale in <a class="reference external" href="https://github.com/python/cpython/issues/74033">gh-74033</a>.)</p></li>
<li><p>Remove support for passing additional positional arguments to
<a class="reference internal" href="../library/pathlib.html#pathlib.PurePath.relative_to" title="pathlib.PurePath.relative_to"><code class="xref py py-meth docutils literal notranslate"><span class="pre">PurePath.relative_to()</span></code></a> and <a class="reference internal" href="../library/pathlib.html#pathlib.PurePath.is_relative_to" title="pathlib.PurePath.is_relative_to"><code class="xref py py-meth docutils literal notranslate"><span class="pre">is_relative_to()</span></code></a>.
In previous versions, any such arguments are joined onto <em>other</em>.
(Contributed by Barney Gale in <a class="reference external" href="https://github.com/python/cpython/issues/78707">gh-78707</a>.)</p></li>
</ul>
</section>
<section id="pkgutil">
<h3>pkgutil<a class="headerlink" href="#pkgutil" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Remove the <code class="xref py py-func docutils literal notranslate"><span class="pre">get_loader()</span></code> and <code class="xref py py-func docutils literal notranslate"><span class="pre">find_loader()</span></code> functions,
which have been deprecated since Python 3.12.
(Contributed by Bénédikt Tran in <a class="reference external" href="https://github.com/python/cpython/issues/97850">gh-97850</a>.)</p></li>
</ul>
</section>
<section id="pty">
<h3>pty<a class="headerlink" href="#pty" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Remove the <code class="xref py py-func docutils literal notranslate"><span class="pre">master_open()</span></code> and <code class="xref py py-func docutils literal notranslate"><span class="pre">slave_open()</span></code> functions,
which have been deprecated since Python 3.12.
Use <a class="reference internal" href="../library/pty.html#pty.openpty" title="pty.openpty"><code class="xref py py-func docutils literal notranslate"><span class="pre">pty.openpty()</span></code></a> instead.
(Contributed by Nikita Sobolev in <a class="reference external" href="https://github.com/python/cpython/issues/118824">gh-118824</a>.)</p></li>
</ul>
</section>
<section id="sqlite3">
<h3>sqlite3<a class="headerlink" href="#sqlite3" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Remove <code class="xref py py-data docutils literal notranslate"><span class="pre">version</span></code> and <code class="xref py py-data docutils literal notranslate"><span class="pre">version_info</span></code> from
the <a class="reference internal" href="../library/sqlite3.html#module-sqlite3" title="sqlite3: A DB-API 2.0 implementation using SQLite 3.x."><code class="xref py py-mod docutils literal notranslate"><span class="pre">sqlite3</span></code></a> module;
use <a class="reference internal" href="../library/sqlite3.html#sqlite3.sqlite_version" title="sqlite3.sqlite_version"><code class="xref py py-data docutils literal notranslate"><span class="pre">sqlite_version</span></code></a> and <a class="reference internal" href="../library/sqlite3.html#sqlite3.sqlite_version_info" title="sqlite3.sqlite_version_info"><code class="xref py py-data docutils literal notranslate"><span class="pre">sqlite_version_info</span></code></a>
for the actual version number of the runtime SQLite library.
(Contributed by Hugo van Kemenade in <a class="reference external" href="https://github.com/python/cpython/issues/118924">gh-118924</a>.)</p></li>
<li><p>Using a sequence of parameters with named placeholders now
raises a <a class="reference internal" href="../library/sqlite3.html#sqlite3.ProgrammingError" title="sqlite3.ProgrammingError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ProgrammingError</span></code></a>,
having been deprecated since Python 3.12.
(Contributed by Erlend E. Aasland in <a class="reference external" href="https://github.com/python/cpython/issues/118928">gh-118928</a> and <a class="reference external" href="https://github.com/python/cpython/issues/101693">gh-101693</a>.)</p></li>
</ul>
</section>
<section id="id12">
<h3>urllib<a class="headerlink" href="#id12" title="Link to this heading">¶</a></h3>
<ul>
<li><p>Remove the <code class="xref py py-class docutils literal notranslate"><span class="pre">Quoter</span></code> class from <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>,
which has been deprecated since Python 3.11.
(Contributed by Nikita Sobolev in <a class="reference external" href="https://github.com/python/cpython/issues/118827">gh-118827</a>.)</p></li>
<li><p>Remove the <code class="xref py py-class docutils literal notranslate"><span class="pre">URLopener</span></code> and <code class="xref py py-class docutils literal notranslate"><span class="pre">FancyURLopener</span></code> classes
from <a class="reference internal" href="../library/urllib.request.html#module-urllib.request" title="urllib.request: Extensible library for opening URLs."><code class="xref py py-mod docutils literal notranslate"><span class="pre">urllib.request</span></code></a>,
which have been deprecated since Python 3.3.</p>
<p><code class="docutils literal notranslate"><span class="pre">myopener.open()</span></code> can be replaced with <a class="reference internal" href="../library/urllib.request.html#urllib.request.urlopen" title="urllib.request.urlopen"><code class="xref py py-func docutils literal notranslate"><span class="pre">urlopen()</span></code></a>.
<code class="docutils literal notranslate"><span class="pre">myopener.retrieve()</span></code> can be replaced with
<a class="reference internal" href="../library/urllib.request.html#urllib.request.urlretrieve" title="urllib.request.urlretrieve"><code class="xref py py-func docutils literal notranslate"><span class="pre">urlretrieve()</span></code></a>.
Customisations to the opener classes can be replaced by passing
customized handlers to <a class="reference internal" href="../library/urllib.request.html#urllib.request.build_opener" title="urllib.request.build_opener"><code class="xref py py-func docutils literal notranslate"><span class="pre">build_opener()</span></code></a>.
(Contributed by Barney Gale in <a class="reference external" href="https://github.com/python/cpython/issues/84850">gh-84850</a>.)</p>
</li>
</ul>
</section>
</section>
<section id="deprecated">
<h2>Deprecated<a class="headerlink" href="#deprecated" title="Link to this heading">¶</a></h2>
<section id="new-deprecations">
<h3>New deprecations<a class="headerlink" href="#new-deprecations" title="Link to this heading">¶</a></h3>
<ul>
<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;
complex numbers 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>
<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 class="simple">
<li><p>Passing the undocumented keyword argument <em>prefix_chars</em> to the
<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> method is now deprecated.
(Contributed by Savannah Ostrowski in <a class="reference external" href="https://github.com/python/cpython/issues/125563">gh-125563</a>.)</p></li>
<li><p>Deprecated 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.
Anything relating to resource management should be handled
downstream, after the arguments have been parsed.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/58032">gh-58032</a>.)</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>The <code class="xref py py-func docutils literal notranslate"><span class="pre">asyncio.iscoroutinefunction()</span></code> is now 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>The <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
the <em>loop_factory</em> argument 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-python 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/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>:
The <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> function is now deprecated,
and will be removed in a future version of Python.
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.
(Contributed by Inada Naoki in <a class="reference external" href="https://github.com/python/cpython/issues/133036">gh-133036</a>.)</p></li>
<li><p><a class="reference internal" href="../library/ctypes.html#module-ctypes" title="ctypes: A foreign function library for Python."><code class="xref py py-mod docutils literal notranslate"><span class="pre">ctypes</span></code></a>:</p>
<ul class="simple">
<li><p>On non-Windows platforms, 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">Structure._pack_</span></code></a> to use a
MSVC-compatible default memory layout is now deprecated in favor of setting
<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">Structure._layout_</span></code></a> to <code class="docutils literal notranslate"><span class="pre">'ms'</span></code>, and will be removed in Python 3.19.
(Contributed by Petr Viktorin in <a class="reference external" href="https://github.com/python/cpython/issues/131747">gh-131747</a>.)</p></li>
<li><p>Calling <a class="reference internal" href="../library/ctypes.html#ctypes.POINTER" title="ctypes.POINTER"><code class="xref py py-func docutils literal notranslate"><span class="pre">ctypes.POINTER()</span></code></a> on a string is now deprecated.
Use <a class="reference internal" href="../library/ctypes.html#ctypes-incomplete-types"><span class="std std-ref">incomplete types</span></a>
for self-referential structures.
Also, the internal <code class="docutils literal notranslate"><span class="pre">ctypes._pointer_type_cache</span></code> is deprecated.
See <a class="reference internal" href="../library/ctypes.html#ctypes.POINTER" title="ctypes.POINTER"><code class="xref py py-func docutils literal notranslate"><span class="pre">ctypes.POINTER()</span></code></a> for updated implementation details.
(Contributed by Sergey Myrianov in <a class="reference external" href="https://github.com/python/cpython/issues/100926">gh-100926</a>.)</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>:
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 is now deprecated;
the parameters will be made positional-only in Python 3.16.
(Contributed by Kirill Podoprigora in <a class="reference external" href="https://github.com/python/cpython/issues/121676">gh-121676</a>.)</p></li>
<li><p><a class="reference internal" href="../library/logging.html#module-logging" title="logging: Flexible event logging system for applications."><code class="xref py py-mod docutils literal notranslate"><span class="pre">logging</span></code></a>:
Support for custom logging handlers with the <em>strm</em> argument
is now 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>:
Valid extensions are either empty or must start with ‘.’ 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>
<li><p><code class="xref py py-mod docutils literal notranslate"><span class="pre">nturl2path</span></code>:
This module is now deprecated. Call <a class="reference internal" href="../library/urllib.request.html#urllib.request.url2pathname" title="urllib.request.url2pathname"><code class="xref py py-func docutils literal notranslate"><span class="pre">urllib.request.url2pathname()</span></code></a>
and <a class="reference internal" href="../library/urllib.request.html#urllib.request.pathname2url" title="urllib.request.pathname2url"><code class="xref py py-func docutils literal notranslate"><span class="pre">pathname2url()</span></code></a> instead.
(Contributed by Barney Gale in <a class="reference external" href="https://github.com/python/cpython/issues/125866">gh-125866</a>.)</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>:
The <a class="reference internal" href="../library/os.html#os.popen" title="os.popen"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.popen()</span></code></a> and <a class="reference internal" href="../library/os.html#os.spawnl" title="os.spawnl"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.spawn*</span></code></a> functions
are now <a class="reference internal" href="../glossary.html#term-soft-deprecated"><span class="xref std std-term">soft deprecated</span></a>.
They should no longer be used to write new code.
The <a class="reference internal" href="../library/subprocess.html#module-subprocess" title="subprocess: Subprocess management."><code class="xref py py-mod docutils literal notranslate"><span class="pre">subprocess</span></code></a> module is recommended instead.
(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/120743">gh-120743</a>.)</p></li>
<li><p><a class="reference internal" href="../library/pathlib.html#module-pathlib" title="pathlib: Object-oriented filesystem paths"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pathlib</span></code></a>:
<code class="xref py py-meth docutils literal notranslate"><span class="pre">pathlib.PurePath.as_uri()</span></code> is now deprecated
and scheduled for removal in Python 3.19.
Use <a class="reference internal" href="../library/pathlib.html#pathlib.Path.as_uri" title="pathlib.Path.as_uri"><code class="xref py py-meth docutils literal notranslate"><span class="pre">pathlib.Path.as_uri()</span></code></a> instead.
(Contributed by Barney Gale in <a class="reference external" href="https://github.com/python/cpython/issues/123599">gh-123599</a>.)</p></li>
<li><p><a class="reference internal" href="../library/pdb.html#module-pdb" title="pdb: The Python debugger for interactive interpreters."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pdb</span></code></a>:
The undocumented <code class="docutils literal notranslate"><span class="pre">pdb.Pdb.curframe_locals</span></code> attribute is now a deprecated
read-only property, which will be removed in a future version of Python.
The low overhead dynamic frame locals access added in Python 3.13 by <span class="target" id="index-65"></span><a class="pep reference external" href="https://peps.python.org/pep-0667/"><strong>PEP 667</strong></a>
means the frame locals cache reference previously stored in this attribute
is no longer needed. Derived debuggers should access
<code class="docutils literal notranslate"><span class="pre">pdb.Pdb.curframe.f_locals</span></code> directly in Python 3.13 and later versions.
(Contributed by Tian Gao in <a class="reference external" href="https://github.com/python/cpython/issues/124369">gh-124369</a> and <a class="reference external" href="https://github.com/python/cpython/issues/125951">gh-125951</a>.)</p></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>:
Deprecate <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">symtable.Class.get_methods()</span></code></a> due to the lack of interest,
scheduled for removal in Python 3.16.
(Contributed by Bénédikt Tran in <a class="reference external" href="https://github.com/python/cpython/issues/119698">gh-119698</a>.)</p></li>
<li><p><a class="reference internal" href="../library/tkinter.html#module-tkinter" title="tkinter: Interface to Tcl/Tk for graphical user interfaces"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tkinter</span></code></a>:
The <code class="xref py py-class docutils literal notranslate"><span class="pre">tkinter.Variable</span></code> methods <code class="xref py py-meth docutils literal notranslate"><span class="pre">trace_variable()</span></code>,
<code class="xref py py-meth docutils literal notranslate"><span class="pre">trace_vdelete()</span></code> and <code class="xref py py-meth docutils literal notranslate"><span class="pre">trace_vinfo()</span></code> are now deprecated.
Use <code class="xref py py-meth docutils literal notranslate"><span class="pre">trace_add()</span></code>, <code class="xref py py-meth docutils literal notranslate"><span class="pre">trace_remove()</span></code> and <code class="xref py py-meth docutils literal notranslate"><span class="pre">trace_info()</span></code> instead.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/120220">gh-120220</a>.)</p></li>
<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>:
Accepting objects with false values (like <code class="docutils literal notranslate"><span class="pre">0</span></code> and <code class="docutils literal notranslate"><span class="pre">[]</span></code>) except empty
strings, bytes-like objects and <code class="docutils literal notranslate"><span class="pre">None</span></code> in <a class="reference internal" href="../library/urllib.parse.html#urllib.parse.parse_qsl" title="urllib.parse.parse_qsl"><code class="xref py py-func docutils literal notranslate"><span class="pre">parse_qsl()</span></code></a>
and <a class="reference internal" href="../library/urllib.parse.html#urllib.parse.parse_qs" title="urllib.parse.parse_qs"><code class="xref py py-func docutils literal notranslate"><span class="pre">parse_qs()</span></code></a> is now deprecated.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/116897">gh-116897</a>.)</p></li>
</ul>
</section>
<section id="pending-removal-in-python-3-15">
<h3>Pending removal in Python 3.15<a class="headerlink" href="#pending-removal-in-python-3-15" title="Link to this heading">¶</a></h3>
<ul 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-66"></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("Point",</span> <span class="pre">x=int,</span> <span class="pre">y=int)</span></code>)
has been deprecated since Python 3.13.
Use the class-based syntax or the functional syntax instead.</p></li>
<li><p>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("TD")</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("TD",</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("TD",</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">
<h3>Pending removal in Python 3.16<a class="headerlink" href="#pending-removal-in-python-3-16" title="Link to this heading">¶</a></h3>
<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-67"></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">
<h3>Pending removal in Python 3.17<a class="headerlink" href="#pending-removal-in-python-3-17" title="Link to this heading">¶</a></h3>
<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-68"></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-69"></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">
<h3>Pending removal in Python 3.19<a class="headerlink" href="#pending-removal-in-python-3-19" title="Link to this heading">¶</a></h3>
<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">
<h3>Pending removal in future versions<a class="headerlink" href="#pending-removal-in-future-versions" title="Link to this heading">¶</a></h3>
<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>
<section id="cpython-bytecode-changes">
<h2>CPython bytecode changes<a class="headerlink" href="#cpython-bytecode-changes" title="Link to this heading">¶</a></h2>
<ul class="simple">
<li><p>Replaced the opcode <code class="xref std std-opcode docutils literal notranslate"><span class="pre">BINARY_SUBSCR</span></code> by the <a class="reference internal" href="../library/dis.html#opcode-BINARY_OP"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">BINARY_OP</span></code></a>
opcode with the <code class="docutils literal notranslate"><span class="pre">NB_SUBSCR</span></code> oparg.
(Contributed by Irit Katriel in <a class="reference external" href="https://github.com/python/cpython/issues/100239">gh-100239</a>.)</p></li>
<li><p>Add the <a class="reference internal" href="../library/dis.html#opcode-BUILD_INTERPOLATION"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">BUILD_INTERPOLATION</span></code></a> and <a class="reference internal" href="../library/dis.html#opcode-BUILD_TEMPLATE"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">BUILD_TEMPLATE</span></code></a>
opcodes to construct new <a class="reference internal" href="../library/string.templatelib.html#string.templatelib.Interpolation" title="string.templatelib.Interpolation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Interpolation</span></code></a>
and <a class="reference internal" href="../library/string.templatelib.html#string.templatelib.Template" title="string.templatelib.Template"><code class="xref py py-class docutils literal notranslate"><span class="pre">Template</span></code></a> instances, respectively.
(Contributed by Lysandros Nikolaou and others in <a class="reference external" href="https://github.com/python/cpython/issues/132661">gh-132661</a>;
see also <a class="reference internal" href="#whatsnew314-template-string-literals"><span class="std std-ref">PEP 750: Template strings</span></a>).</p></li>
<li><p>Remove the <code class="xref std std-opcode docutils literal notranslate"><span class="pre">BUILD_CONST_KEY_MAP</span></code> opcode.
Use <a class="reference internal" href="../library/dis.html#opcode-BUILD_MAP"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">BUILD_MAP</span></code></a> instead.
(Contributed by Mark Shannon in <a class="reference external" href="https://github.com/python/cpython/issues/122160">gh-122160</a>.)</p></li>
<li><p>Replace the <code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_ASSERTION_ERROR</span></code> opcode with
<a class="reference internal" href="../library/dis.html#opcode-LOAD_COMMON_CONSTANT"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_COMMON_CONSTANT</span></code></a> and add support for loading
<a class="reference internal" href="../library/exceptions.html#NotImplementedError" title="NotImplementedError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NotImplementedError</span></code></a>.</p></li>
<li><p>Add the <a class="reference internal" href="../library/dis.html#opcode-LOAD_FAST_BORROW"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_FAST_BORROW</span></code></a> and <a class="reference internal" href="../library/dis.html#opcode-LOAD_FAST_BORROW_LOAD_FAST_BORROW"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_FAST_BORROW_LOAD_FAST_BORROW</span></code></a>
opcodes to reduce reference counting overhead when the interpreter can prove
that the reference in the frame outlives the reference loaded onto the stack.
(Contributed by Matt Page in <a class="reference external" href="https://github.com/python/cpython/issues/130704">gh-130704</a>.)</p></li>
<li><p>Add the <a class="reference internal" href="../library/dis.html#opcode-LOAD_SMALL_INT"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_SMALL_INT</span></code></a> opcode, which pushes a small integer
equal to the <code class="docutils literal notranslate"><span class="pre">oparg</span></code> to the stack.
The <code class="xref std std-opcode docutils literal notranslate"><span class="pre">RETURN_CONST</span></code> opcode is removed as it is no longer used.
(Contributed by Mark Shannon in <a class="reference external" href="https://github.com/python/cpython/issues/125837">gh-125837</a>.)</p></li>
<li><p>Add the new <a class="reference internal" href="../library/dis.html#opcode-LOAD_SPECIAL"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_SPECIAL</span></code></a> instruction.
Generate code for <a class="reference internal" href="../reference/compound_stmts.html#with"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">with</span></code></a> and <a class="reference internal" href="../reference/compound_stmts.html#async-with"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">async</span> <span class="pre">with</span></code></a> statements
using the new instruction.
Removed the <code class="xref std std-opcode docutils literal notranslate"><span class="pre">BEFORE_WITH</span></code> and <code class="xref std std-opcode docutils literal notranslate"><span class="pre">BEFORE_ASYNC_WITH</span></code> instructions.
(Contributed by Mark Shannon in <a class="reference external" href="https://github.com/python/cpython/issues/120507">gh-120507</a>.)</p></li>
<li><p>Add the <a class="reference internal" href="../library/dis.html#opcode-POP_ITER"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">POP_ITER</span></code></a> opcode to support ‘virtual’ iterators.
(Contributed by Mark Shannon in <a class="reference external" href="https://github.com/python/cpython/issues/132554">gh-132554</a>.)</p></li>
</ul>
<section id="pseudo-instructions">
<h3>Pseudo-instructions<a class="headerlink" href="#pseudo-instructions" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Add the <code class="xref std std-opcode docutils literal notranslate"><span class="pre">ANNOTATIONS_PLACEHOLDER</span></code> pseudo instruction
to support partially executed module-level annotations with
<a class="reference internal" href="#whatsnew314-deferred-annotations"><span class="std std-ref">deferred evaluation of annotations</span></a>.
(Contributed by Jelle Zijlstra in <a class="reference external" href="https://github.com/python/cpython/issues/130907">gh-130907</a>.)</p></li>
<li><p>Add the <code class="xref std std-opcode docutils literal notranslate"><span class="pre">BINARY_OP_EXTEND</span></code> pseudo instruction,
which executes a pair of functions (guard and specialization functions)
accessed from the inline cache.
(Contributed by Irit Katriel in <a class="reference external" href="https://github.com/python/cpython/issues/100239">gh-100239</a>.)</p></li>
<li><p>Add three specializations for <a class="reference internal" href="../library/dis.html#opcode-CALL_KW"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">CALL_KW</span></code></a>;
<code class="xref std std-opcode docutils literal notranslate"><span class="pre">CALL_KW_PY</span></code> for calls to Python functions,
<code class="xref std std-opcode docutils literal notranslate"><span class="pre">CALL_KW_BOUND_METHOD</span></code> for calls to bound methods, and
<code class="xref std std-opcode docutils literal notranslate"><span class="pre">CALL_KW_NON_PY</span></code> for all other calls.
(Contributed by Mark Shannon in <a class="reference external" href="https://github.com/python/cpython/issues/118093">gh-118093</a>.)</p></li>
<li><p>Add the <a class="reference internal" href="../library/dis.html#opcode-JUMP_IF_TRUE"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">JUMP_IF_TRUE</span></code></a> and <a class="reference internal" href="../library/dis.html#opcode-JUMP_IF_FALSE"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">JUMP_IF_FALSE</span></code></a> pseudo instructions,
conditional jumps which do not impact the stack.
Replaced by the sequence <code class="docutils literal notranslate"><span class="pre">COPY</span> <span class="pre">1</span></code>, <code class="docutils literal notranslate"><span class="pre">TO_BOOL</span></code>, <code class="docutils literal notranslate"><span class="pre">POP_JUMP_IF_TRUE/FALSE</span></code>.
(Contributed by Irit Katriel in <a class="reference external" href="https://github.com/python/cpython/issues/124285">gh-124285</a>.)</p></li>
<li><p>Add the <code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_CONST_MORTAL</span></code> pseudo instruction.
(Contributed by Mark Shannon in <a class="reference external" href="https://github.com/python/cpython/issues/128685">gh-128685</a>.)</p></li>
<li><p>Add the <a class="reference internal" href="../library/dis.html#opcode-LOAD_CONST_IMMORTAL"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_CONST_IMMORTAL</span></code></a> pseudo instruction,
which does the same as <code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_CONST</span></code>, but is more efficient
for immortal objects.
(Contributed by Mark Shannon in <a class="reference external" href="https://github.com/python/cpython/issues/125837">gh-125837</a>.)</p></li>
<li><p>Add the <a class="reference internal" href="../library/dis.html#opcode-NOT_TAKEN"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">NOT_TAKEN</span></code></a> pseudo instruction, used by <a class="reference internal" href="../library/sys.monitoring.html#module-sys.monitoring" title="sys.monitoring: Access and control event monitoring"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sys.monitoring</span></code></a>
to record branch events (such as <a class="reference internal" href="../library/sys.monitoring.html#monitoring-event-BRANCH_LEFT"><code class="xref std std-monitoring-event docutils literal notranslate"><span class="pre">BRANCH_LEFT</span></code></a>).
(Contributed by Mark Shannon in <a class="reference external" href="https://github.com/python/cpython/issues/122548">gh-122548</a>.)</p></li>
</ul>
</section>
</section>
<section id="c-api-changes">
<h2>C API changes<a class="headerlink" href="#c-api-changes" title="Link to this heading">¶</a></h2>
<section id="python-configuration-c-api">
<span id="whatsnew314-capi-config"></span><h3>Python configuration C API<a class="headerlink" href="#python-configuration-c-api" title="Link to this heading">¶</a></h3>
<p>Add a <a class="reference internal" href="../c-api/init_config.html#pyinitconfig-api"><span class="std std-ref">PyInitConfig C API</span></a> to configure the Python
initialization without relying on C structures and the ability to make
ABI-compatible changes in the future.</p>
<p>Complete the <span class="target" id="index-70"></span><a class="pep reference external" href="https://peps.python.org/pep-0587/"><strong>PEP 587</strong></a> <a class="reference internal" href="../c-api/init_config.html#pyconfig-api"><span class="std std-ref">PyConfig C API</span></a> by adding
<a class="reference internal" href="../c-api/init_config.html#c.PyInitConfig_AddModule" title="PyInitConfig_AddModule"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyInitConfig_AddModule()</span></code></a> which can be used to add a built-in extension
module; a feature previously referred to as the “inittab”.</p>
<p>Add <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> and <a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Set" title="PyConfig_Set"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Set()</span></code></a> functions to get and set
the current runtime configuration.</p>
<p><span class="target" id="index-71"></span><a class="pep reference external" href="https://peps.python.org/pep-0587/"><strong>PEP 587</strong></a> ‘Python Initialization Configuration’ unified all the ways
to configure Python’s initialization. This PEP also unifies the configuration
of Python’s preinitialization and initialization in a single API.
Moreover, this PEP only provides a single choice to embed Python,
instead of having two ‘Python’ and ‘Isolated’ choices (PEP 587),
to further simplify the API.</p>
<p>The lower level PEP 587 PyConfig API remains available for use cases
with an intentionally higher level of coupling to CPython implementation details
(such as emulating the full functionality of CPython’s CLI, including its
configuration mechanisms).</p>
<p>(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/107954">gh-107954</a>.)</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><span class="target" id="index-72"></span><a class="pep reference external" href="https://peps.python.org/pep-0741/"><strong>PEP 741</strong></a> and <span class="target" id="index-73"></span><a class="pep reference external" href="https://peps.python.org/pep-0587/"><strong>PEP 587</strong></a></p>
</div>
</section>
<section id="new-features-in-the-c-api">
<h3>New features in the C API<a class="headerlink" href="#new-features-in-the-c-api" title="Link to this heading">¶</a></h3>
<ul>
<li><p>Add <a class="reference internal" href="../c-api/apiabiversion.html#c.Py_PACK_VERSION" title="Py_PACK_VERSION"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_PACK_VERSION()</span></code></a> and <a class="reference internal" href="../c-api/apiabiversion.html#c.Py_PACK_FULL_VERSION" title="Py_PACK_FULL_VERSION"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_PACK_FULL_VERSION()</span></code></a>,
two new macros for bit-packing Python version numbers.
This is useful for comparisons with <a class="reference internal" href="../c-api/apiabiversion.html#c.Py_Version" title="Py_Version"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_Version</span></code></a>
or <a class="reference internal" href="../c-api/apiabiversion.html#c.PY_VERSION_HEX" title="PY_VERSION_HEX"><code class="xref c c-macro docutils literal notranslate"><span class="pre">PY_VERSION_HEX</span></code></a>.
(Contributed by Petr Viktorin in <a class="reference external" href="https://github.com/python/cpython/issues/128629">gh-128629</a>.)</p></li>
<li><p>Add <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(sep,</span> <span class="pre">iterable)</span></code></a> function,
similar to <code class="docutils literal notranslate"><span class="pre">sep.join(iterable)</span></code> in Python.
(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/121645">gh-121645</a>.)</p></li>
<li><p>Add functions to manipulate the configuration of the current
runtime Python interpreter
(<a class="reference internal" href="#whatsnew314-capi-config"><span class="std std-ref">PEP 741: Python configuration C API</span></a>):</p>
<ul class="simple">
<li><p><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></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyConfig_GetInt" title="PyConfig_GetInt"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_GetInt()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Set" title="PyConfig_Set"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Set()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyConfig_Names" title="PyConfig_Names"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_Names()</span></code></a></p></li>
</ul>
<p>(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/107954">gh-107954</a>.)</p>
</li>
<li><p>Add functions to configure Python initialization
(<a class="reference internal" href="#whatsnew314-capi-config"><span class="std std-ref">PEP 741: Python configuration C API</span></a>):</p>
<ul class="simple">
<li><p><a class="reference internal" href="../c-api/init_config.html#c.Py_InitializeFromInitConfig" title="Py_InitializeFromInitConfig"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_InitializeFromInitConfig()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyInitConfig_AddModule" title="PyInitConfig_AddModule"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyInitConfig_AddModule()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyInitConfig_Create" title="PyInitConfig_Create"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyInitConfig_Create()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyInitConfig_Free" title="PyInitConfig_Free"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyInitConfig_Free()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyInitConfig_FreeStrList" title="PyInitConfig_FreeStrList"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyInitConfig_FreeStrList()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyInitConfig_GetError" title="PyInitConfig_GetError"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyInitConfig_GetError()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyInitConfig_GetExitCode" title="PyInitConfig_GetExitCode"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyInitConfig_GetExitCode()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyInitConfig_GetInt" title="PyInitConfig_GetInt"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyInitConfig_GetInt()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyInitConfig_GetStr" title="PyInitConfig_GetStr"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyInitConfig_GetStr()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyInitConfig_GetStrList" title="PyInitConfig_GetStrList"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyInitConfig_GetStrList()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyInitConfig_HasOption" title="PyInitConfig_HasOption"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyInitConfig_HasOption()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyInitConfig_SetInt" title="PyInitConfig_SetInt"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyInitConfig_SetInt()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyInitConfig_SetStr" title="PyInitConfig_SetStr"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyInitConfig_SetStr()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/init_config.html#c.PyInitConfig_SetStrList" title="PyInitConfig_SetStrList"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyInitConfig_SetStrList()</span></code></a></p></li>
</ul>
<p>(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/107954">gh-107954</a>.)</p>
</li>
<li><p>Add <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> function to open a file.
This works similarly to the standard C <code class="xref c c-func docutils literal notranslate"><span class="pre">fopen()</span></code> function,
instead accepting a Python object for the <em>path</em> parameter
and setting an exception on error.
The corresponding new <a class="reference internal" href="../c-api/sys.html#c.Py_fclose" title="Py_fclose"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_fclose()</span></code></a> function should be used
to close a file.
(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/127350">gh-127350</a>.)</p></li>
<li><p>Add <a class="reference internal" href="../c-api/hash.html#c.Py_HashBuffer" title="Py_HashBuffer"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_HashBuffer()</span></code></a> to compute and return the hash value of a buffer.
(Contributed by Antoine Pitrou and Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/122854">gh-122854</a>.)</p></li>
<li><p>Add <a class="reference internal" href="../c-api/import.html#c.PyImport_ImportModuleAttr" title="PyImport_ImportModuleAttr"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyImport_ImportModuleAttr()</span></code></a> and
<a class="reference internal" href="../c-api/import.html#c.PyImport_ImportModuleAttrString" title="PyImport_ImportModuleAttrString"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyImport_ImportModuleAttrString()</span></code></a> helper functions to import a module
and get an attribute of the module.
(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/128911">gh-128911</a>.)</p></li>
<li><p>Add <a class="reference internal" href="../c-api/iter.html#c.PyIter_NextItem" title="PyIter_NextItem"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyIter_NextItem()</span></code></a> to replace <a class="reference internal" href="../c-api/iter.html#c.PyIter_Next" title="PyIter_Next"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyIter_Next()</span></code></a>,
which has an ambiguous return value.
(Contributed by Irit Katriel and Erlend Aasland in <a class="reference external" href="https://github.com/python/cpython/issues/105201">gh-105201</a>.)</p></li>
<li><p>Add <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> function to get the sign 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> objects.
(Contributed by Sergey B Kirpichev in <a class="reference external" href="https://github.com/python/cpython/issues/116560">gh-116560</a>.)</p></li>
<li><p>Add <a class="reference internal" href="../c-api/long.html#c.PyLong_IsPositive" title="PyLong_IsPositive"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_IsPositive()</span></code></a>, <a class="reference internal" href="../c-api/long.html#c.PyLong_IsNegative" title="PyLong_IsNegative"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_IsNegative()</span></code></a>
and <a class="reference internal" href="../c-api/long.html#c.PyLong_IsZero" title="PyLong_IsZero"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_IsZero()</span></code></a> for checking if <a class="reference internal" href="../c-api/long.html#c.PyLongObject" title="PyLongObject"><code class="xref c c-type docutils literal notranslate"><span class="pre">PyLongObject</span></code></a>
is positive, negative, or zero, respectively.
(Contributed by James Roy and Sergey B Kirpichev in <a class="reference external" href="https://github.com/python/cpython/issues/126061">gh-126061</a>.)</p></li>
<li><p>Add new functions to convert C <code class="docutils literal notranslate"><span class="pre"><stdint.h></span></code> numbers to/from
Python <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> objects:</p>
<ul class="simple">
<li><p><a class="reference internal" href="../c-api/long.html#c.PyLong_AsInt32" title="PyLong_AsInt32"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_AsInt32()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/long.html#c.PyLong_AsInt64" title="PyLong_AsInt64"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_AsInt64()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/long.html#c.PyLong_AsUInt32" title="PyLong_AsUInt32"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_AsUInt32()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/long.html#c.PyLong_AsUInt64" title="PyLong_AsUInt64"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_AsUInt64()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/long.html#c.PyLong_FromInt32" title="PyLong_FromInt32"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_FromInt32()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/long.html#c.PyLong_FromInt64" title="PyLong_FromInt64"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_FromInt64()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/long.html#c.PyLong_FromUInt32" title="PyLong_FromUInt32"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_FromUInt32()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/long.html#c.PyLong_FromUInt64" title="PyLong_FromUInt64"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_FromUInt64()</span></code></a></p></li>
</ul>
<p>(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/120389">gh-120389</a>.)</p>
</li>
<li><p>Add a new import and export API for Python <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> objects
(<span class="target" id="index-74"></span><a class="pep reference external" href="https://peps.python.org/pep-0757/"><strong>PEP 757</strong></a>):</p>
<ul class="simple">
<li><p><a class="reference internal" href="../c-api/long.html#c.PyLong_GetNativeLayout" title="PyLong_GetNativeLayout"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_GetNativeLayout()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/long.html#c.PyLong_Export" title="PyLong_Export"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_Export()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/long.html#c.PyLong_FreeExport" title="PyLong_FreeExport"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_FreeExport()</span></code></a></p></li>
<li><p><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><a class="reference internal" href="../c-api/long.html#c.PyLongWriter_Finish" title="PyLongWriter_Finish"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLongWriter_Finish()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/long.html#c.PyLongWriter_Discard" title="PyLongWriter_Discard"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLongWriter_Discard()</span></code></a></p></li>
</ul>
<p>(Contributed by Sergey B Kirpichev and Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/102471">gh-102471</a>.)</p>
</li>
<li><p>Add <a class="reference internal" href="../c-api/monitoring.html#c.PyMonitoring_FireBranchLeftEvent" title="PyMonitoring_FireBranchLeftEvent"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyMonitoring_FireBranchLeftEvent()</span></code></a> and
<a class="reference internal" href="../c-api/monitoring.html#c.PyMonitoring_FireBranchRightEvent" title="PyMonitoring_FireBranchRightEvent"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyMonitoring_FireBranchRightEvent()</span></code></a> for generating
<a class="reference internal" href="../library/sys.monitoring.html#monitoring-event-BRANCH_LEFT"><code class="xref std std-monitoring-event docutils literal notranslate"><span class="pre">BRANCH_LEFT</span></code></a> and <a class="reference internal" href="../library/sys.monitoring.html#monitoring-event-BRANCH_RIGHT"><code class="xref std std-monitoring-event docutils literal notranslate"><span class="pre">BRANCH_RIGHT</span></code></a>
events, respectively.
(Contributed by Mark Shannon in <a class="reference external" href="https://github.com/python/cpython/issues/122548">gh-122548</a>.)</p></li>
<li><p>Add <a class="reference internal" href="../c-api/type.html#c.PyType_Freeze" title="PyType_Freeze"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyType_Freeze()</span></code></a> function to make a type immutable.
(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/121654">gh-121654</a>.)</p></li>
<li><p>Add <a class="reference internal" href="../c-api/type.html#c.PyType_GetBaseByToken" title="PyType_GetBaseByToken"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyType_GetBaseByToken()</span></code></a> and <a class="reference internal" href="../c-api/type.html#c.Py_tp_token" title="Py_tp_token"><code class="xref c c-data docutils literal notranslate"><span class="pre">Py_tp_token</span></code></a> slot
for easier superclass identification, which attempts to resolve the
type checking issue mentioned in <span class="target" id="index-75"></span><a class="pep reference external" href="https://peps.python.org/pep-0630/#type-checking"><strong>PEP 630</strong></a>.
(Contributed in <a class="reference external" href="https://github.com/python/cpython/issues/124153">gh-124153</a>.)</p></li>
<li><p>Add a new <a class="reference internal" href="../c-api/unicode.html#c.PyUnicode_Equal" title="PyUnicode_Equal"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicode_Equal()</span></code></a> function to test if two
strings are equal.
The function is also added to the Limited C API.
(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/124502">gh-124502</a>.)</p></li>
<li><p>Add a new <a class="reference internal" href="../c-api/unicode.html#c.PyUnicodeWriter" title="PyUnicodeWriter"><code class="xref c c-type docutils literal notranslate"><span class="pre">PyUnicodeWriter</span></code></a> API to create a Python <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>
object, with the following functions:</p>
<ul class="simple">
<li><p><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">PyUnicodeWriter_Create()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/unicode.html#c.PyUnicodeWriter_DecodeUTF8Stateful" title="PyUnicodeWriter_DecodeUTF8Stateful"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicodeWriter_DecodeUTF8Stateful()</span></code></a></p></li>
<li><p><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()</span></code></a></p></li>
<li><p><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()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/unicode.html#c.PyUnicodeWriter_Format" title="PyUnicodeWriter_Format"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicodeWriter_Format()</span></code></a></p></li>
<li><p><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()</span></code></a></p></li>
<li><p><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()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/unicode.html#c.PyUnicodeWriter_WriteRepr" title="PyUnicodeWriter_WriteRepr"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicodeWriter_WriteRepr()</span></code></a></p></li>
<li><p><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()</span></code></a></p></li>
<li><p><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()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/unicode.html#c.PyUnicodeWriter_WriteUCS4" title="PyUnicodeWriter_WriteUCS4"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicodeWriter_WriteUCS4()</span></code></a></p></li>
<li><p><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()</span></code></a></p></li>
<li><p><a class="reference internal" href="../c-api/unicode.html#c.PyUnicodeWriter_WriteWideChar" title="PyUnicodeWriter_WriteWideChar"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicodeWriter_WriteWideChar()</span></code></a></p></li>
</ul>
<p>(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/119182">gh-119182</a>.)</p>
</li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">k</span></code> and <code class="docutils literal notranslate"><span class="pre">K</span></code> formats in <a class="reference internal" href="../c-api/arg.html#c.PyArg_ParseTuple" title="PyArg_ParseTuple"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTuple()</span></code></a> and
similar functions now use <a class="reference internal" href="../reference/datamodel.html#object.__index__" title="object.__index__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__index__()</span></code></a> if available,
like all other integer formats.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/112068">gh-112068</a>.)</p></li>
<li><p>Add support for a new <code class="docutils literal notranslate"><span class="pre">p</span></code> format unit in <a class="reference internal" href="../c-api/arg.html#c.Py_BuildValue" title="Py_BuildValue"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_BuildValue()</span></code></a>
that produces a Python <a class="reference internal" href="../library/functions.html#bool" title="bool"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a> object from a C integer.
(Contributed by Pablo Galindo in <a class="reference external" href="https://bugs.python.org/issue?@action=redirect&bpo=45325">bpo-45325</a>.)</p></li>
<li><p>Add <a class="reference internal" href="../c-api/object.html#c.PyUnstable_IsImmortal" title="PyUnstable_IsImmortal"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnstable_IsImmortal()</span></code></a> for determining if
an object is <a class="reference internal" href="../glossary.html#term-immortal"><span class="xref std std-term">immortal</span></a>, for debugging purposes.
(Contributed by Peter Bierma in <a class="reference external" href="https://github.com/python/cpython/issues/128509">gh-128509</a>.)</p></li>
<li><p>Add <a class="reference internal" href="../c-api/object.html#c.PyUnstable_Object_EnableDeferredRefcount" title="PyUnstable_Object_EnableDeferredRefcount"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnstable_Object_EnableDeferredRefcount()</span></code></a> for enabling
deferred reference counting, as outlined in <span class="target" id="index-76"></span><a class="pep reference external" href="https://peps.python.org/pep-0703/"><strong>PEP 703</strong></a>.</p></li>
<li><p>Add <a class="reference internal" href="../c-api/object.html#c.PyUnstable_Object_IsUniquelyReferenced" title="PyUnstable_Object_IsUniquelyReferenced"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnstable_Object_IsUniquelyReferenced()</span></code></a> as
a replacement for <code class="docutils literal notranslate"><span class="pre">Py_REFCNT(op)</span> <span class="pre">==</span> <span class="pre">1</span></code> on <a class="reference internal" href="../glossary.html#term-free-threading"><span class="xref std std-term">free threaded</span></a> builds.
(Contributed by Peter Bierma in <a class="reference external" href="https://github.com/python/cpython/issues/133140">gh-133140</a>.)</p></li>
<li><p>Add <a class="reference internal" href="../c-api/object.html#c.PyUnstable_Object_IsUniqueReferencedTemporary" title="PyUnstable_Object_IsUniqueReferencedTemporary"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnstable_Object_IsUniqueReferencedTemporary()</span></code></a> to
determine if an object is a unique temporary object on the
interpreter’s operand stack.
This can be used in some cases as a replacement for checking
if <a class="reference internal" href="../c-api/refcounting.html#c.Py_REFCNT" title="Py_REFCNT"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_REFCNT()</span></code></a> is <code class="docutils literal notranslate"><span class="pre">1</span></code> for Python objects passed
as arguments to C API functions.
(Contributed by Sam Gross in <a class="reference external" href="https://github.com/python/cpython/issues/133164">gh-133164</a>.)</p></li>
</ul>
</section>
<section id="limited-c-api-changes">
<h3>Limited C API changes<a class="headerlink" href="#limited-c-api-changes" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>In the limited C API version 3.14 and newer, <a class="reference internal" href="../c-api/structures.html#c.Py_TYPE" title="Py_TYPE"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_TYPE()</span></code></a> and
<a class="reference internal" href="../c-api/refcounting.html#c.Py_REFCNT" title="Py_REFCNT"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_REFCNT()</span></code></a> are now implemented as an opaque function call
to hide implementation details.
(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/120600">gh-120600</a> and <a class="reference external" href="https://github.com/python/cpython/issues/124127">gh-124127</a>.)</p></li>
<li><p>Remove the <a class="reference internal" href="../c-api/sequence.html#c.PySequence_Fast_GET_SIZE" title="PySequence_Fast_GET_SIZE"><code class="xref c c-macro docutils literal notranslate"><span class="pre">PySequence_Fast_GET_SIZE</span></code></a>,
<a class="reference internal" href="../c-api/sequence.html#c.PySequence_Fast_GET_ITEM" title="PySequence_Fast_GET_ITEM"><code class="xref c c-macro docutils literal notranslate"><span class="pre">PySequence_Fast_GET_ITEM</span></code></a>,
and <a class="reference internal" href="../c-api/sequence.html#c.PySequence_Fast_ITEMS" title="PySequence_Fast_ITEMS"><code class="xref c c-macro docutils literal notranslate"><span class="pre">PySequence_Fast_ITEMS</span></code></a>
macros from the limited C API, since they have always been broken
in the limited C API.
(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/91417">gh-91417</a>.)</p></li>
</ul>
</section>
<section id="removed-c-apis">
<span id="whatsnew314-c-api-removed"></span><h3>Removed C APIs<a class="headerlink" href="#removed-c-apis" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>Creating <a class="reference internal" href="../c-api/typeobj.html#c.Py_TPFLAGS_IMMUTABLETYPE" title="Py_TPFLAGS_IMMUTABLETYPE"><code class="xref c c-data docutils literal notranslate"><span class="pre">immutable</span> <span class="pre">types</span></code></a> with
mutable bases was deprecated in Python 3.12,
and now raises a <a class="reference internal" href="../library/exceptions.html#TypeError" title="TypeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code></a>.
(Contributed by Nikita Sobolev in <a class="reference external" href="https://github.com/python/cpython/issues/119775">gh-119775</a>.)</p></li>
<li><p>Remove <code class="docutils literal notranslate"><span class="pre">PyDictObject.ma_version_tag</span></code> member, which was deprecated
in Python 3.12.
Use the <a class="reference internal" href="../c-api/dict.html#c.PyDict_AddWatcher" title="PyDict_AddWatcher"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyDict_AddWatcher()</span></code></a> API instead.
(Contributed by Sam Gross in <a class="reference external" href="https://github.com/python/cpython/issues/124296">gh-124296</a>.)</p></li>
<li><p>Remove the private <code class="docutils literal notranslate"><span class="pre">_Py_InitializeMain()</span></code> function.
It was a <a class="reference internal" href="../glossary.html#term-provisional-API"><span class="xref std std-term">provisional API</span></a> added to Python 3.8 by <span class="target" id="index-77"></span><a class="pep reference external" href="https://peps.python.org/pep-0587/"><strong>PEP 587</strong></a>.
(Contributed by Victor Stinner in <a class="reference external" href="https://github.com/python/cpython/issues/129033">gh-129033</a>.)</p></li>
<li><p>Remove the undocumented APIs <code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_C_RECURSION_LIMIT</span></code>
and <code class="xref c c-member docutils literal notranslate"><span class="pre">PyThreadState.c_recursion_remaining</span></code>.
These were added in 3.13 and have been removed without deprecation.
Use <a class="reference internal" href="../c-api/exceptions.html#c.Py_EnterRecursiveCall" title="Py_EnterRecursiveCall"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_EnterRecursiveCall()</span></code></a> to guard against runaway
recursion in C code.
(Removed by Petr Viktorin in <a class="reference external" href="https://github.com/python/cpython/issues/133079">gh-133079</a>, see also <a class="reference external" href="https://github.com/python/cpython/issues/130396">gh-130396</a>.)</p></li>
</ul>
</section>
<section id="deprecated-c-apis">
<span id="whatsnew314-c-api-deprecated"></span><h3>Deprecated C APIs<a class="headerlink" href="#deprecated-c-apis" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p>The <code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_HUGE_VAL</span></code> macro is now <a class="reference internal" href="../glossary.html#term-soft-deprecated"><span class="xref std std-term">soft deprecated</span></a>.
Use <code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_INFINITY</span></code> instead.
(Contributed by Sergey B Kirpichev in <a class="reference external" href="https://github.com/python/cpython/issues/120026">gh-120026</a>.)</p></li>
<li><p>The <code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_IS_NAN</span></code>, <code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_IS_INFINITY</span></code>,
and <code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_IS_FINITE</span></code> macros are now <a class="reference internal" href="../glossary.html#term-soft-deprecated"><span class="xref std std-term">soft deprecated</span></a>.
Use <code class="xref c c-macro docutils literal notranslate"><span class="pre">isnan</span></code>, <code class="xref c c-macro docutils literal notranslate"><span class="pre">isinf</span></code> and <code class="xref c c-macro docutils literal notranslate"><span class="pre">isfinite</span></code>
instead, available from <code class="file docutils literal notranslate"><span class="pre">math.h</span></code> since C99.
(Contributed by Sergey B Kirpichev in <a class="reference external" href="https://github.com/python/cpython/issues/119613">gh-119613</a>.)</p></li>
<li><p>Non-tuple sequences are now deprecated as argument for the <code class="docutils literal notranslate"><span class="pre">(items)</span></code>
format unit in <a class="reference internal" href="../c-api/arg.html#c.PyArg_ParseTuple" title="PyArg_ParseTuple"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTuple()</span></code></a> and other <a class="reference internal" href="../c-api/arg.html#arg-parsing"><span class="std std-ref">argument
parsing</span></a> functions if <em>items</em> contains format units
which store a <a class="reference internal" href="../c-api/arg.html#c-arg-borrowed-buffer"><span class="std std-ref">borrowed buffer</span></a> or a
<a class="reference internal" href="../glossary.html#term-borrowed-reference"><span class="xref std std-term">borrowed reference</span></a>.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/50333">gh-50333</a>.)</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">_PyMonitoring_FireBranchEvent</span></code> function is now deprecated
and should be replaced with calls to
<a class="reference internal" href="../c-api/monitoring.html#c.PyMonitoring_FireBranchLeftEvent" title="PyMonitoring_FireBranchLeftEvent"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyMonitoring_FireBranchLeftEvent()</span></code></a> and
<a class="reference internal" href="../c-api/monitoring.html#c.PyMonitoring_FireBranchRightEvent" title="PyMonitoring_FireBranchRightEvent"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyMonitoring_FireBranchRightEvent()</span></code></a>.</p></li>
<li><p>The previously undocumented function <a class="reference internal" href="../c-api/sequence.html#c.PySequence_In" title="PySequence_In"><code class="xref c c-func docutils literal notranslate"><span class="pre">PySequence_In()</span></code></a> is
now <a class="reference internal" href="../glossary.html#term-soft-deprecated"><span class="xref std std-term">soft deprecated</span></a>.
Use <a class="reference internal" href="../c-api/sequence.html#c.PySequence_Contains" title="PySequence_Contains"><code class="xref c c-func docutils literal notranslate"><span class="pre">PySequence_Contains()</span></code></a> instead.
(Contributed by Yuki Kobayashi in <a class="reference external" href="https://github.com/python/cpython/issues/127896">gh-127896</a>.)</p></li>
</ul>
<section id="id13">
<h4>Pending removal in Python 3.15<a class="headerlink" href="#id13" title="Link to this heading">¶</a></h4>
<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("module_search_paths")</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("base_prefix")</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("prefix")</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("base_exec_prefix")</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("exec_prefix")</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("executable")</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("executable")</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("home")</span></code></a> or the
<span class="target" id="index-78"></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("parser_debug")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_VerboseFlag" title="Py_VerboseFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_VerboseFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.verbose" title="PyConfig.verbose"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.verbose</span></code></a> 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("verbose")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_QuietFlag" title="Py_QuietFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_QuietFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.quiet" title="PyConfig.quiet"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.quiet</span></code></a> 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("quiet")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_InteractiveFlag" title="Py_InteractiveFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_InteractiveFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.interactive" title="PyConfig.interactive"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.interactive</span></code></a> 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("interactive")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_InspectFlag" title="Py_InspectFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_InspectFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.inspect" title="PyConfig.inspect"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.inspect</span></code></a> 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("inspect")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_OptimizeFlag" title="Py_OptimizeFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_OptimizeFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.optimization_level" title="PyConfig.optimization_level"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.optimization_level</span></code></a> 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("optimization_level")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_NoSiteFlag" title="Py_NoSiteFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_NoSiteFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.site_import" title="PyConfig.site_import"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.site_import</span></code></a> 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("site_import")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_BytesWarningFlag" title="Py_BytesWarningFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_BytesWarningFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.bytes_warning" title="PyConfig.bytes_warning"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.bytes_warning</span></code></a> 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("bytes_warning")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_FrozenFlag" title="Py_FrozenFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_FrozenFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.pathconfig_warnings" title="PyConfig.pathconfig_warnings"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.pathconfig_warnings</span></code></a> 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("pathconfig_warnings")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_IgnoreEnvironmentFlag" title="Py_IgnoreEnvironmentFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_IgnoreEnvironmentFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.use_environment" title="PyConfig.use_environment"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.use_environment</span></code></a> 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("use_environment")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_DontWriteBytecodeFlag" title="Py_DontWriteBytecodeFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_DontWriteBytecodeFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.write_bytecode" title="PyConfig.write_bytecode"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.write_bytecode</span></code></a> 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("write_bytecode")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_NoUserSiteDirectory" title="Py_NoUserSiteDirectory"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_NoUserSiteDirectory</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.user_site_directory" title="PyConfig.user_site_directory"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.user_site_directory</span></code></a> 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("user_site_directory")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_UnbufferedStdioFlag" title="Py_UnbufferedStdioFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_UnbufferedStdioFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.buffered_stdio" title="PyConfig.buffered_stdio"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.buffered_stdio</span></code></a> 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("buffered_stdio")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_HashRandomizationFlag" title="Py_HashRandomizationFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_HashRandomizationFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.use_hash_seed" title="PyConfig.use_hash_seed"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.use_hash_seed</span></code></a>
and <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.hash_seed" title="PyConfig.hash_seed"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.hash_seed</span></code></a> 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("hash_seed")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_IsolatedFlag" title="Py_IsolatedFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_IsolatedFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.isolated" title="PyConfig.isolated"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.isolated</span></code></a> 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("isolated")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_LegacyWindowsFSEncodingFlag" title="Py_LegacyWindowsFSEncodingFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_LegacyWindowsFSEncodingFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyPreConfig.legacy_windows_fs_encoding" title="PyPreConfig.legacy_windows_fs_encoding"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyPreConfig.legacy_windows_fs_encoding</span></code></a> 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("legacy_windows_fs_encoding")</span></code></a> instead.</p></li>
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_LegacyWindowsStdioFlag" title="Py_LegacyWindowsStdioFlag"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_LegacyWindowsStdioFlag</span></code></a>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.legacy_windows_stdio" title="PyConfig.legacy_windows_stdio"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.legacy_windows_stdio</span></code></a> 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("legacy_windows_stdio")</span></code></a> instead.</p></li>
<li><p><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_FileSystemDefaultEncoding</span></code>, <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("filesystem_encoding")</span></code></a> instead.</p></li>
<li><p><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_FileSystemDefaultEncodeErrors</span></code>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyConfig.filesystem_errors" title="PyConfig.filesystem_errors"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyConfig.filesystem_errors</span></code></a> 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("filesystem_errors")</span></code></a> instead.</p></li>
<li><p><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_UTF8Mode</span></code>:
Use <a class="reference internal" href="../c-api/init_config.html#c.PyPreConfig.utf8_mode" title="PyPreConfig.utf8_mode"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyPreConfig.utf8_mode</span></code></a> 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("utf8_mode")</span></code></a> instead.
(see <a class="reference internal" href="../c-api/init_config.html#c.Py_PreInitialize" title="Py_PreInitialize"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_PreInitialize()</span></code></a>)</p></li>
</ul>
<p>The <a class="reference internal" href="../c-api/init.html#c.Py_InitializeFromConfig" title="Py_InitializeFromConfig"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_InitializeFromConfig()</span></code></a> API should be used with
<a class="reference internal" href="../c-api/init_config.html#c.PyConfig" title="PyConfig"><code class="xref c c-type docutils literal notranslate"><span class="pre">PyConfig</span></code></a> 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="id14">
<h4>Pending removal in Python 3.16<a class="headerlink" href="#id14" title="Link to this heading">¶</a></h4>
<ul class="simple">
<li><p>The bundled copy of <code class="docutils literal notranslate"><span class="pre">libmpdec</span></code>.</p></li>
</ul>
</section>
<section id="pending-removal-in-python-3-18">
<h4>Pending removal in Python 3.18<a class="headerlink" href="#pending-removal-in-python-3-18" title="Link to this heading">¶</a></h4>
<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(&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(&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(&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(&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(&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(&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(&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(&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="id15">
<h4>Pending removal in future versions<a class="headerlink" href="#id15" title="Link to this heading">¶</a></h4>
<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>
<section id="build-changes">
<span id="whatsnew314-build-changes"></span><h2>Build changes<a class="headerlink" href="#build-changes" title="Link to this heading">¶</a></h2>
<ul class="simple">
<li><p><span class="target" id="index-79"></span><a class="pep reference external" href="https://peps.python.org/pep-0776/"><strong>PEP 776</strong></a>: Emscripten is now an officially supported platform at
<span class="target" id="index-80"></span><a class="pep reference external" href="https://peps.python.org/pep-0011/#tier-3"><strong>tier 3</strong></a>. As a part of this effort, more than 25 bugs in
<a class="reference external" href="https://emscripten.org/docs/porting/emscripten-runtime-environment.html">Emscripten libc</a> were fixed. Emscripten now includes support
for <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>, <a class="reference internal" href="../library/termios.html#module-termios" title="termios: POSIX style tty control. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">termios</span></code></a>, and <a class="reference internal" href="../library/fcntl.html#module-fcntl" title="fcntl: The fcntl() and ioctl() system calls. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">fcntl</span></code></a>, as well as
experimental support for the new <a class="reference internal" href="../tutorial/interpreter.html#tut-interactive"><span class="std std-ref">default interactive shell</span></a>.
(Contributed by R. Hood Chatham in <a class="reference external" href="https://github.com/python/cpython/issues/127146">gh-127146</a>, <a class="reference external" href="https://github.com/python/cpython/issues/127683">gh-127683</a>, and <a class="reference external" href="https://github.com/python/cpython/issues/136931">gh-136931</a>.)</p>
</li>
<li><p>Official Android binary releases are now provided on <a class="reference external" href="https://www.python.org/downloads/android/">python.org</a>.</p>
</li>
<li><p>GNU Autoconf 2.72 is now required to generate <code class="file docutils literal notranslate"><span class="pre">configure</span></code>.
(Contributed by Erlend Aasland in <a class="reference external" href="https://github.com/python/cpython/issues/115765">gh-115765</a>.)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">wasm32-unknown-emscripten</span></code> is now a <span class="target" id="index-81"></span><a class="pep reference external" href="https://peps.python.org/pep-0011/"><strong>PEP 11</strong></a> tier 3 platform.
(Contributed by R. Hood Chatham in <a class="reference external" href="https://github.com/python/cpython/issues/127146">gh-127146</a>, <a class="reference external" href="https://github.com/python/cpython/issues/127683">gh-127683</a>, and <a class="reference external" href="https://github.com/python/cpython/issues/136931">gh-136931</a>.)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">#pragma</span></code>-based linking with <code class="docutils literal notranslate"><span class="pre">python3*.lib</span></code> can now be switched off
with <span class="c-expr sig sig-inline c"><a class="reference internal" href="../extending/windows.html#c.Py_NO_LINK_LIB" title="Py_NO_LINK_LIB"><span class="n">Py_NO_LINK_LIB</span></a></span>.
(Contributed by Jean-Christophe Fillion-Robin in <a class="reference external" href="https://github.com/python/cpython/issues/82909">gh-82909</a>.)</p></li>
<li><p>CPython now enables a set of recommended compiler options by default
for improved security.
Use the <a class="reference internal" href="../using/configure.html#cmdoption-disable-safety"><code class="xref std std-option docutils literal notranslate"><span class="pre">--disable-safety</span></code></a> <code class="file docutils literal notranslate"><span class="pre">configure</span></code> option to disable them,
or the <a class="reference internal" href="../using/configure.html#cmdoption-enable-slower-safety"><code class="xref std std-option docutils literal notranslate"><span class="pre">--enable-slower-safety</span></code></a> option for a larger set
of compiler options, albeit with a performance cost.</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">WITH_FREELISTS</span></code> macro and <code class="docutils literal notranslate"><span class="pre">--without-freelists</span></code> <code class="file docutils literal notranslate"><span class="pre">configure</span></code>
option have been removed.</p></li>
<li><p>The new <code class="file docutils literal notranslate"><span class="pre">configure</span></code> option <a class="reference internal" href="../using/configure.html#cmdoption-with-tail-call-interp"><code class="xref std std-option docutils literal notranslate"><span class="pre">--with-tail-call-interp</span></code></a>
may be used to enable the experimental tail call interpreter.
See <a class="reference internal" href="#whatsnew314-tail-call-interpreter"><span class="std std-ref">A new type of interpreter</span></a> for further details.</p></li>
<li><p>To disable the new remote debugging support, use the
<a class="reference internal" href="../using/configure.html#cmdoption-without-remote-debug"><code class="xref std std-option docutils literal notranslate"><span class="pre">--without-remote-debug</span></code></a> <code class="file docutils literal notranslate"><span class="pre">configure</span></code> option.
This may be useful for security reasons.</p></li>
<li><p>iOS and macOS apps can now be configured to redirect <code class="docutils literal notranslate"><span class="pre">stdout</span></code> and
<code class="docutils literal notranslate"><span class="pre">stderr</span></code> content to the system log.
(Contributed by Russell Keith-Magee in <a class="reference external" href="https://github.com/python/cpython/issues/127592">gh-127592</a>.)</p></li>
<li><p>The iOS testbed is now able to stream test output while the test is running.
The testbed can also be used to run the test suite of projects other than
CPython itself.
(Contributed by Russell Keith-Magee in <a class="reference external" href="https://github.com/python/cpython/issues/127592">gh-127592</a>.)</p></li>
</ul>
<section id="build-details-json">
<span id="whatsnew314-build-details"></span><h3><code class="file docutils literal notranslate"><span class="pre">build-details.json</span></code><a class="headerlink" href="#build-details-json" title="Link to this heading">¶</a></h3>
<p>Installations of Python now contain a new file, <code class="file docutils literal notranslate"><span class="pre">build-details.json</span></code>.
This is a static JSON document containing build details for CPython,
to allow for introspection without needing to run code.
This is helpful for use-cases such as Python launchers, cross-compilation,
and so on.</p>
<p><code class="file docutils literal notranslate"><span class="pre">build-details.json</span></code> must be installed in the platform-independent
standard library directory. This corresponds to the <a class="reference internal" href="../library/sysconfig.html#installation-paths"><span class="std std-ref">‘stdlib’</span></a> <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> installation path,
which can be found by running <code class="docutils literal notranslate"><span class="pre">sysconfig.get_path('stdlib')</span></code>.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><span class="target" id="index-82"></span><a class="pep reference external" href="https://peps.python.org/pep-0739/"><strong>PEP 739</strong></a> – <code class="docutils literal notranslate"><span class="pre">build-details.json</span></code> 1.0 – a static description file
for Python build details</p>
</div>
</section>
<section id="discontinuation-of-pgp-signatures">
<span id="whatsnew314-no-more-pgp"></span><h3>Discontinuation of PGP signatures<a class="headerlink" href="#discontinuation-of-pgp-signatures" title="Link to this heading">¶</a></h3>
<p>PGP (Pretty Good Privacy) signatures will not be provided
for releases of Python 3.14 or future versions.
To verify CPython artifacts, users must use <a class="reference external" href="https://www.python.org/downloads/metadata/sigstore/">Sigstore verification materials</a>.
Releases have been signed using <a class="reference external" href="https://www.sigstore.dev/">Sigstore</a> since Python 3.11.</p>
<p>This change in release process was specified in <span class="target" id="index-83"></span><a class="pep reference external" href="https://peps.python.org/pep-0761/"><strong>PEP 761</strong></a>.</p>
</section>
<section id="free-threaded-python-is-officially-supported">
<span id="whatsnew314-free-threaded-now-supported"></span><h3>Free-threaded Python is officially supported<a class="headerlink" href="#free-threaded-python-is-officially-supported" title="Link to this heading">¶</a></h3>
<p>The free-threaded build of Python is now supported and no longer experimental.
This is the start of <a class="reference external" href="https://discuss.python.org/t/37075">phase II</a> where
free-threaded Python is officially supported but still optional.</p>
<p>The free-threading team are confident that the project is on the right path,
and appreciate the continued dedication from everyone working to make
free-threading ready for broader adoption across the Python community.</p>
<p>With these recommendations and the acceptance of this PEP, the Python developer
community should broadly advertise that free-threading is a supported
Python build option now and into the future, and that it will not be removed
without a proper deprecation schedule.</p>
<p>Any decision to transition to <a class="reference external" href="https://discuss.python.org/t/37075">phase III</a>,
with free-threading as the default or sole build of Python is still undecided,
and dependent on many factors both within CPython itself and the community.
This decision is for the future.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><span class="target" id="index-84"></span><a class="pep reference external" href="https://peps.python.org/pep-0779/"><strong>PEP 779</strong></a></p>
<p><a class="reference external" href="https://discuss.python.org/t/84319/123">PEP 779’s acceptance</a></p>
</div>
</section>
<section id="binary-releases-for-the-experimental-just-in-time-compiler">
<span id="whatsnew314-jit-compiler"></span><h3>Binary releases for the experimental just-in-time compiler<a class="headerlink" href="#binary-releases-for-the-experimental-just-in-time-compiler" title="Link to this heading">¶</a></h3>
<p>The official macOS and Windows release binaries now include an <em>experimental</em>
just-in-time (JIT) compiler. Although it is <strong>not</strong> recommended for production
use, it can be tested by setting <span class="target" id="index-85"></span><a class="reference internal" href="../using/cmdline.html#envvar-PYTHON_JIT"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHON_JIT=1</span></code></a> as an
environment variable. Downstream source builds and redistributors can use the
<a class="reference internal" href="../using/configure.html#cmdoption-enable-experimental-jit"><code class="xref std std-option docutils literal notranslate"><span class="pre">--enable-experimental-jit=yes-off</span></code></a> configuration option for similar
behavior.</p>
<p>The JIT is at an early stage and still in active development. As such, the
typical performance impact of enabling it can range from 10% slower to 20%
faster, depending on workload. To aid in testing and evaluation, a set of
introspection functions has been provided in the <a class="reference internal" href="../library/sys.html#sys._jit" title="sys._jit"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys._jit</span></code></a> namespace.
<a class="reference internal" href="../library/sys.html#sys._jit.is_available" title="sys._jit.is_available"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys._jit.is_available()</span></code></a> can be used to determine if the current executable
supports JIT compilation, while <a class="reference internal" href="../library/sys.html#sys._jit.is_enabled" title="sys._jit.is_enabled"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys._jit.is_enabled()</span></code></a> can be used to tell
if JIT compilation has been enabled for the current process.</p>
<p>Currently, the most significant missing functionality is that native debuggers
and profilers like <code class="docutils literal notranslate"><span class="pre">gdb</span></code> and <code class="docutils literal notranslate"><span class="pre">perf</span></code> are unable to unwind through JIT frames
(Python debuggers and profilers, like <a class="reference internal" href="../library/pdb.html#module-pdb" title="pdb: The Python debugger for interactive interpreters."><code class="xref py py-mod docutils literal notranslate"><span class="pre">pdb</span></code></a> or <a class="reference internal" href="../library/profile.html#module-profile" title="profile: Python source profiler."><code class="xref py py-mod docutils literal notranslate"><span class="pre">profile</span></code></a>, continue to
work without modification). Free-threaded builds do not support JIT compilation.</p>
<p>Please report any bugs or major performance regressions that you encounter!</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><span class="target" id="index-86"></span><a class="pep reference external" href="https://peps.python.org/pep-0744/"><strong>PEP 744</strong></a></p>
</div>
</section>
</section>
<section id="porting-to-python-3-14">
<h2>Porting to Python 3.14<a class="headerlink" href="#porting-to-python-3-14" title="Link to this heading">¶</a></h2>
<p>This section lists previously described changes and other bugfixes
that may require changes to your code.</p>
<section id="changes-in-the-python-api">
<h3>Changes in the Python API<a class="headerlink" href="#changes-in-the-python-api" title="Link to this heading">¶</a></h3>
<ul>
<li><p>On Unix platforms other than macOS, <em>forkserver</em> is now the default
<a class="reference internal" href="../library/multiprocessing.html#multiprocessing-start-methods"><span class="std std-ref">start method</span></a> for <a class="reference internal" href="../library/multiprocessing.html#module-multiprocessing" title="multiprocessing: Process-based parallelism."><code class="xref py py-mod docutils literal notranslate"><span class="pre">multiprocessing</span></code></a>
and <a class="reference internal" href="../library/concurrent.futures.html#concurrent.futures.ProcessPoolExecutor" title="concurrent.futures.ProcessPoolExecutor"><code class="xref py py-class docutils literal notranslate"><span class="pre">ProcessPoolExecutor</span></code></a>, instead of <em>fork</em>.</p>
<p>See <a class="reference internal" href="#whatsnew314-concurrent-futures-start-method"><span class="std std-ref">(1)</span></a> and
<a class="reference internal" href="#whatsnew314-multiprocessing-start-method"><span class="std std-ref">(2)</span></a> for details.</p>
<p>If you encounter <a class="reference internal" href="../library/exceptions.html#NameError" title="NameError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NameError</span></code></a>s or pickling errors coming out of
<a class="reference internal" href="../library/multiprocessing.html#module-multiprocessing" title="multiprocessing: Process-based parallelism."><code class="xref py py-mod docutils literal notranslate"><span class="pre">multiprocessing</span></code></a> or <a class="reference internal" href="../library/concurrent.futures.html#module-concurrent.futures" title="concurrent.futures: Execute computations concurrently using threads or processes."><code class="xref py py-mod docutils literal notranslate"><span class="pre">concurrent.futures</span></code></a>, see the
<a class="reference internal" href="../library/multiprocessing.html#multiprocessing-programming-forkserver"><span class="std std-ref">forkserver restrictions</span></a>.</p>
<p>This change does not affect Windows or macOS, where <a class="reference internal" href="../library/multiprocessing.html#multiprocessing-start-method-spawn"><span class="std std-ref">‘spawn’</span></a> remains the default start method.</p>
</li>
<li><p><a class="reference internal" href="../library/functools.html#functools.partial" title="functools.partial"><code class="xref py py-class docutils literal notranslate"><span class="pre">functools.partial</span></code></a> is now a method descriptor.
Wrap it in <a class="reference internal" href="../library/functions.html#staticmethod" title="staticmethod"><code class="xref py py-func docutils literal notranslate"><span class="pre">staticmethod()</span></code></a> if you want to preserve the old behavior.
(Contributed by Serhiy Storchaka and Dominykas Grigonis in <a class="reference external" href="https://github.com/python/cpython/issues/121027">gh-121027</a>.)</p></li>
<li><p>The <a class="reference internal" href="#whatsnew314-incremental-gc"><span class="std std-ref">garbage collector is now incremental</span></a>,
which means that the behavior of <a class="reference internal" href="../library/gc.html#gc.collect" title="gc.collect"><code class="xref py py-func docutils literal notranslate"><span class="pre">gc.collect()</span></code></a> changes slightly:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">gc.collect(1)</span></code>: Performs an increment of garbage collection,
rather than collecting generation 1.</p></li>
<li><p>Other calls to <code class="xref py py-func docutils literal notranslate"><span class="pre">gc.collect()</span></code> are unchanged.</p></li>
</ul>
</li>
<li><p>The <a class="reference internal" href="../library/locale.html#locale.nl_langinfo" title="locale.nl_langinfo"><code class="xref py py-func docutils literal notranslate"><span class="pre">locale.nl_langinfo()</span></code></a> function now temporarily sets the <code class="docutils literal notranslate"><span class="pre">LC_CTYPE</span></code>
locale in some cases.
This temporary change affects other threads.
(Contributed by Serhiy Storchaka in <a class="reference external" href="https://github.com/python/cpython/issues/69998">gh-69998</a>.)</p></li>
<li><p><a class="reference internal" href="../library/types.html#types.UnionType" title="types.UnionType"><code class="xref py py-class docutils literal notranslate"><span class="pre">types.UnionType</span></code></a> is now an alias for <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>,
causing changes in some behaviors.
See <a class="reference internal" href="#whatsnew314-typing-union"><span class="std std-ref">above</span></a> for more details.
(Contributed by Jelle Zijlstra in <a class="reference external" href="https://github.com/python/cpython/issues/105499">gh-105499</a>.)</p></li>
<li><p>The runtime behavior of annotations has changed in various ways; see
<a class="reference internal" href="#whatsnew314-deferred-annotations"><span class="std std-ref">above</span></a> for details. While most code that interacts
with annotations should continue to work, some undocumented details may behave
differently.</p></li>
<li><p>As part of making the <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> CLI public,
it now exits with <code class="docutils literal notranslate"><span class="pre">1</span></code> on failure instead of <code class="docutils literal notranslate"><span class="pre">0</span></code>
and <code class="docutils literal notranslate"><span class="pre">2</span></code> on incorrect command-line parameters instead of <code class="docutils literal notranslate"><span class="pre">1</span></code>.
Error messages are now printed to stderr.</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">\B</span></code> pattern in regular expression now matches the empty string
when given as the entire pattern, which may cause behavioural changes.</p></li>
<li><p>On FreeBSD, <a class="reference internal" href="../library/sys.html#sys.platform" title="sys.platform"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.platform</span></code></a> no longer contains the major version number.</p></li>
</ul>
</section>
<section id="changes-in-annotations-pep-649-and-pep-749">
<span id="whatsnew314-porting-annotations"></span><h3>Changes in annotations (<span class="target" id="index-87"></span><a class="pep reference external" href="https://peps.python.org/pep-0649/"><strong>PEP 649</strong></a> and <span class="target" id="index-88"></span><a class="pep reference external" href="https://peps.python.org/pep-0749/"><strong>PEP 749</strong></a>)<a class="headerlink" href="#changes-in-annotations-pep-649-and-pep-749" title="Link to this heading">¶</a></h3>
<p>This section contains guidance on changes that may be needed to annotations
or Python code that interacts with or introspects annotations,
due to the changes related to <a class="reference internal" href="#whatsnew314-deferred-annotations"><span class="std std-ref">deferred evaluation of annotations</span></a>.</p>
<p>In the majority of cases, working code from older versions of Python
will not require any changes.</p>
<section id="implications-for-annotated-code">
<h4>Implications for annotated code<a class="headerlink" href="#implications-for-annotated-code" title="Link to this heading">¶</a></h4>
<p>If you define annotations in your code (for example, for use with a static type
checker), then this change probably does not affect you: you can keep
writing annotations the same way you did with previous versions of Python.</p>
<p>You will likely be able to remove quoted strings in annotations, which are frequently
used for forward references. Similarly, if you use <code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">__future__</span> <span class="pre">import</span> <span class="pre">annotations</span></code>
to avoid having to write strings in annotations, you may well be able to
remove that import once you support only Python 3.14 and newer.
However, if you rely on third-party libraries that read annotations,
those libraries may need changes to support unquoted annotations before they
work as expected.</p>
</section>
<section id="implications-for-readers-of-annotations">
<h4>Implications for readers of <code class="docutils literal notranslate"><span class="pre">__annotations__</span></code><a class="headerlink" href="#implications-for-readers-of-annotations" title="Link to this heading">¶</a></h4>
<p>If your code reads the <a class="reference internal" href="../reference/datamodel.html#object.__annotations__" title="object.__annotations__"><code class="xref py py-attr docutils literal notranslate"><span class="pre">__annotations__</span></code></a> attribute on objects,
you may want to make changes in order to support code that relies on
deferred evaluation of annotations.
For example, you may want to use <a class="reference internal" href="../library/annotationlib.html#annotationlib.get_annotations" title="annotationlib.get_annotations"><code class="xref py py-func docutils literal notranslate"><span class="pre">annotationlib.get_annotations()</span></code></a> with
the <a class="reference internal" href="../library/annotationlib.html#annotationlib.Format.FORWARDREF" title="annotationlib.Format.FORWARDREF"><code class="xref py py-attr docutils literal notranslate"><span class="pre">FORWARDREF</span></code></a> format,
as the <a class="reference internal" href="../library/dataclasses.html#module-dataclasses" title="dataclasses: Generate special methods on user-defined classes."><code class="xref py py-mod docutils literal notranslate"><span class="pre">dataclasses</span></code></a> module now does.</p>
<p>The external <a class="extlink-pypi reference external" href="https://pypi.org/project/typing_extensions/">typing_extensions</a> package provides partial backports
of some of the functionality of the <a class="reference internal" href="../library/annotationlib.html#module-annotationlib" title="annotationlib: Functionality for introspecting annotations"><code class="xref py py-mod docutils literal notranslate"><span class="pre">annotationlib</span></code></a> module,
such as the <a class="reference internal" href="../library/annotationlib.html#annotationlib.Format" title="annotationlib.Format"><code class="xref py py-class docutils literal notranslate"><span class="pre">Format</span></code></a> enum and
the <a class="reference internal" href="../library/annotationlib.html#annotationlib.get_annotations" title="annotationlib.get_annotations"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_annotations()</span></code></a> function.
These can be used to write cross-version code that takes advantage of
the new behavior in Python 3.14.</p>
</section>
<section id="related-changes">
<h4>Related changes<a class="headerlink" href="#related-changes" title="Link to this heading">¶</a></h4>
<p>The changes in Python 3.14 are designed to rework how <code class="xref py py-attr docutils literal notranslate"><span class="pre">__annotations__</span></code>
works at runtime while minimizing breakage to code that contains
annotations in source code and to code that reads <code class="xref py py-attr docutils literal notranslate"><span class="pre">__annotations__</span></code>.
However, if you rely on undocumented details of the annotation behavior
or on private functions in the standard library, there are many ways in which
your code may not work in Python 3.14.
To safeguard your code against future changes, only use the documented
functionality of the <a class="reference internal" href="../library/annotationlib.html#module-annotationlib" title="annotationlib: Functionality for introspecting annotations"><code class="xref py py-mod docutils literal notranslate"><span class="pre">annotationlib</span></code></a> module.</p>
<p>In particular, do not read annotations directly from the namespace dictionary
attribute of type objects.
Use <a class="reference internal" href="../library/annotationlib.html#annotationlib.get_annotate_from_class_namespace" title="annotationlib.get_annotate_from_class_namespace"><code class="xref py py-func docutils literal notranslate"><span class="pre">annotationlib.get_annotate_from_class_namespace()</span></code></a> during class
construction and <a class="reference internal" href="../library/annotationlib.html#annotationlib.get_annotations" title="annotationlib.get_annotations"><code class="xref py py-func docutils literal notranslate"><span class="pre">annotationlib.get_annotations()</span></code></a> afterwards.</p>
<p>In previous releases, it was sometimes possible to access class annotations
from an instance of an annotated class. This behavior was undocumented
and accidental, and will no longer work in Python 3.14.</p>
</section>
<section id="from-future-import-annotations">
<h4><code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">__future__</span> <span class="pre">import</span> <span class="pre">annotations</span></code><a class="headerlink" href="#from-future-import-annotations" title="Link to this heading">¶</a></h4>
<p>In Python 3.7, <span class="target" id="index-89"></span><a class="pep reference external" href="https://peps.python.org/pep-0563/"><strong>PEP 563</strong></a> introduced the <code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">__future__</span> <span class="pre">import</span> <span class="pre">annotations</span></code>
<a class="reference internal" href="../reference/simple_stmts.html#future"><span class="std std-ref">future statement</span></a>, which turns all annotations into strings.</p>
<p>However, this statement is now deprecated and it is expected to be removed
in a future version of Python.
This removal will not happen until after Python 3.13 reaches its end of life
in 2029, being the last version of Python without support for deferred
evaluation of annotations.</p>
<p>In Python 3.14, the behavior of code using <code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">__future__</span> <span class="pre">import</span> <span class="pre">annotations</span></code>
is unchanged.</p>
</section>
</section>
<section id="changes-in-the-c-api">
<h3>Changes in the C API<a class="headerlink" href="#changes-in-the-c-api" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p><a class="reference internal" href="../c-api/init.html#c.Py_Finalize" title="Py_Finalize"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_Finalize()</span></code></a> now deletes all interned strings. This
is backwards incompatible to any C extension that holds onto an interned
string after a call to <a class="reference internal" href="../c-api/init.html#c.Py_Finalize" title="Py_Finalize"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_Finalize()</span></code></a> and is then reused after a
call to <a class="reference internal" href="../c-api/init.html#c.Py_Initialize" title="Py_Initialize"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_Initialize()</span></code></a>. Any issues arising from this behavior will
normally result in crashes during the execution of the subsequent call to
<a class="reference internal" href="../c-api/init.html#c.Py_Initialize" title="Py_Initialize"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_Initialize()</span></code></a> from accessing uninitialized memory. To fix, use
an address sanitizer to identify any use-after-free coming from
an interned string and deallocate it during module shutdown.
(Contributed by Eddie Elizondo in <a class="reference external" href="https://github.com/python/cpython/issues/113601">gh-113601</a>.)</p></li>
<li><p>The <a class="reference internal" href="../c-api/exceptions.html#unicodeexceptions"><span class="std std-ref">Unicode Exception Objects</span></a> C API
now raises a <a class="reference internal" href="../library/exceptions.html#TypeError" title="TypeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code></a> if its exception argument is not
a <a class="reference internal" href="../library/exceptions.html#UnicodeError" title="UnicodeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UnicodeError</span></code></a> object.
(Contributed by Bénédikt Tran in <a class="reference external" href="https://github.com/python/cpython/issues/127691">gh-127691</a>.)</p></li>
</ul>
<ul id="whatsnew314-refcount">
<li><p>The interpreter internally avoids some reference count modifications when
loading objects onto the operands stack by <a class="reference internal" href="../glossary.html#term-borrowed-reference"><span class="xref std std-term">borrowing</span></a>
references when possible. This can lead to smaller reference count values
compared to previous Python versions. C API extensions that checked
<a class="reference internal" href="../c-api/refcounting.html#c.Py_REFCNT" title="Py_REFCNT"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_REFCNT()</span></code></a> of <code class="docutils literal notranslate"><span class="pre">1</span></code> to determine if an function argument is not
referenced by any other code should instead use
<a class="reference internal" href="../c-api/object.html#c.PyUnstable_Object_IsUniqueReferencedTemporary" title="PyUnstable_Object_IsUniqueReferencedTemporary"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnstable_Object_IsUniqueReferencedTemporary()</span></code></a> as a safer replacement.</p></li>
<li><p>Private functions promoted to public C APIs:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">_PyBytes_Join()</span></code>: <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="docutils literal notranslate"><span class="pre">_PyLong_IsNegative()</span></code>: <a class="reference internal" href="../c-api/long.html#c.PyLong_IsNegative" title="PyLong_IsNegative"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_IsNegative()</span></code></a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_PyLong_IsPositive()</span></code>: <a class="reference internal" href="../c-api/long.html#c.PyLong_IsPositive" title="PyLong_IsPositive"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_IsPositive()</span></code></a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_PyLong_IsZero()</span></code>: <a class="reference internal" href="../c-api/long.html#c.PyLong_IsZero" title="PyLong_IsZero"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyLong_IsZero()</span></code></a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_PyLong_Sign()</span></code>: <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="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_Dealloc()</span></code>: <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()</span></code></a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_Finish()</span></code>: <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()</span></code></a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_Init()</span></code>: use <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">PyUnicodeWriter_Create()</span></code></a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_Prepare()</span></code>: (no replacement)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_PrepareKind()</span></code>: (no replacement)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_WriteChar()</span></code>: <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()</span></code></a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_WriteStr()</span></code>: <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()</span></code></a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_PyUnicodeWriter_WriteSubstring()</span></code>: <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()</span></code></a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_PyUnicode_EQ()</span></code>: <a class="reference internal" href="../c-api/unicode.html#c.PyUnicode_Equal" title="PyUnicode_Equal"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicode_Equal()</span></code></a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_PyUnicode_Equal()</span></code>: <a class="reference internal" href="../c-api/unicode.html#c.PyUnicode_Equal" title="PyUnicode_Equal"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicode_Equal()</span></code></a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_Py_GetConfig()</span></code>: <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> and <a class="reference internal" href="../c-api/init_config.html#c.PyConfig_GetInt" title="PyConfig_GetInt"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyConfig_GetInt()</span></code></a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_Py_HashBytes()</span></code>: <a class="reference internal" href="../c-api/hash.html#c.Py_HashBuffer" title="Py_HashBuffer"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_HashBuffer()</span></code></a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_Py_fopen_obj()</span></code>: <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>
<li><p><code class="docutils literal notranslate"><span class="pre">PyMutex_IsLocked()</span></code> : <a class="reference internal" href="../c-api/init.html#c.PyMutex_IsLocked" title="PyMutex_IsLocked"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyMutex_IsLocked()</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 most of these new
functions on Python 3.13 and older.</p>
</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="#">What’s new in Python 3.14</a><ul>
<li><a class="reference internal" href="#summary-release-highlights">Summary – Release highlights</a></li>
<li><a class="reference internal" href="#new-features">New features</a><ul>
<li><a class="reference internal" href="#pep-649-pep-749-deferred-evaluation-of-annotations"><strong>PEP 649</strong> & <strong>PEP 749</strong>: Deferred evaluation of annotations</a></li>
<li><a class="reference internal" href="#pep-734-multiple-interpreters-in-the-standard-library"><strong>PEP 734</strong>: Multiple interpreters in the standard library</a></li>
<li><a class="reference internal" href="#pep-750-template-string-literals"><strong>PEP 750</strong>: Template string literals</a></li>
<li><a class="reference internal" href="#pep-768-safe-external-debugger-interface"><strong>PEP 768</strong>: Safe external debugger interface</a></li>
<li><a class="reference internal" href="#a-new-type-of-interpreter">A new type of interpreter</a></li>
<li><a class="reference internal" href="#free-threaded-mode-improvements">Free-threaded mode improvements</a></li>
<li><a class="reference internal" href="#improved-error-messages">Improved error messages</a></li>
<li><a class="reference internal" href="#pep-784-zstandard-support-in-the-standard-library"><strong>PEP 784</strong>: Zstandard support in the standard library</a></li>
<li><a class="reference internal" href="#asyncio-introspection-capabilities">Asyncio introspection capabilities</a></li>
<li><a class="reference internal" href="#concurrent-safe-warnings-control">Concurrent safe warnings control</a></li>
</ul>
</li>
<li><a class="reference internal" href="#other-language-changes">Other language changes</a><ul>
<li><a class="reference internal" href="#built-ins">Built-ins</a></li>
<li><a class="reference internal" href="#command-line-and-environment">Command line and environment</a></li>
<li><a class="reference internal" href="#pep-758-allow-except-and-except-expressions-without-brackets">PEP 758: Allow <code class="docutils literal notranslate"><span class="pre">except</span></code> and <code class="docutils literal notranslate"><span class="pre">except*</span></code> expressions without brackets</a></li>
<li><a class="reference internal" href="#pep-765-control-flow-in-finally-blocks">PEP 765: Control flow in <code class="xref std std-keyword docutils literal notranslate"><span class="pre">finally</span></code> blocks</a></li>
<li><a class="reference internal" href="#incremental-garbage-collection">Incremental garbage collection</a></li>
<li><a class="reference internal" href="#default-interactive-shell">Default interactive shell</a></li>
</ul>
</li>
<li><a class="reference internal" href="#new-modules">New modules</a></li>
<li><a class="reference internal" href="#improved-modules">Improved modules</a><ul>
<li><a class="reference internal" href="#argparse">argparse</a></li>
<li><a class="reference internal" href="#ast">ast</a></li>
<li><a class="reference internal" href="#asyncio">asyncio</a></li>
<li><a class="reference internal" href="#calendar">calendar</a></li>
<li><a class="reference internal" href="#concurrent-futures">concurrent.futures</a></li>
<li><a class="reference internal" href="#configparser">configparser</a></li>
<li><a class="reference internal" href="#contextvars">contextvars</a></li>
<li><a class="reference internal" href="#ctypes">ctypes</a></li>
<li><a class="reference internal" href="#curses">curses</a></li>
<li><a class="reference internal" href="#datetime">datetime</a></li>
<li><a class="reference internal" href="#decimal">decimal</a></li>
<li><a class="reference internal" href="#difflib">difflib</a></li>
<li><a class="reference internal" href="#dis">dis</a></li>
<li><a class="reference internal" href="#errno">errno</a></li>
<li><a class="reference internal" href="#faulthandler">faulthandler</a></li>
<li><a class="reference internal" href="#fnmatch">fnmatch</a></li>
<li><a class="reference internal" href="#fractions">fractions</a></li>
<li><a class="reference internal" href="#functools">functools</a></li>
<li><a class="reference internal" href="#getopt">getopt</a></li>
<li><a class="reference internal" href="#getpass">getpass</a></li>
<li><a class="reference internal" href="#graphlib">graphlib</a></li>
<li><a class="reference internal" href="#heapq">heapq</a></li>
<li><a class="reference internal" href="#hmac">hmac</a></li>
<li><a class="reference internal" href="#http">http</a></li>
<li><a class="reference internal" href="#imaplib">imaplib</a></li>
<li><a class="reference internal" href="#inspect">inspect</a></li>
<li><a class="reference internal" href="#io">io</a></li>
<li><a class="reference internal" href="#json">json</a></li>
<li><a class="reference internal" href="#linecache">linecache</a></li>
<li><a class="reference internal" href="#logging-handlers">logging.handlers</a></li>
<li><a class="reference internal" href="#math">math</a></li>
<li><a class="reference internal" href="#mimetypes">mimetypes</a></li>
<li><a class="reference internal" href="#multiprocessing">multiprocessing</a></li>
<li><a class="reference internal" href="#operator">operator</a></li>
<li><a class="reference internal" href="#os">os</a></li>
<li><a class="reference internal" href="#os-path">os.path</a></li>
<li><a class="reference internal" href="#pathlib">pathlib</a></li>
<li><a class="reference internal" href="#pdb">pdb</a></li>
<li><a class="reference internal" href="#pickle">pickle</a></li>
<li><a class="reference internal" href="#platform">platform</a></li>
<li><a class="reference internal" href="#pydoc">pydoc</a></li>
<li><a class="reference internal" href="#re">re</a></li>
<li><a class="reference internal" href="#socket">socket</a></li>
<li><a class="reference internal" href="#ssl">ssl</a></li>
<li><a class="reference internal" href="#struct">struct</a></li>
<li><a class="reference internal" href="#symtable">symtable</a></li>
<li><a class="reference internal" href="#sys">sys</a></li>
<li><a class="reference internal" href="#sys-monitoring">sys.monitoring</a></li>
<li><a class="reference internal" href="#sysconfig">sysconfig</a></li>
<li><a class="reference internal" href="#tarfile">tarfile</a></li>
<li><a class="reference internal" href="#threading">threading</a></li>
<li><a class="reference internal" href="#tkinter">tkinter</a></li>
<li><a class="reference internal" href="#turtle">turtle</a></li>
<li><a class="reference internal" href="#types">types</a></li>
<li><a class="reference internal" href="#typing">typing</a></li>
<li><a class="reference internal" href="#unicodedata">unicodedata</a></li>
<li><a class="reference internal" href="#unittest">unittest</a></li>
<li><a class="reference internal" href="#urllib">urllib</a></li>
<li><a class="reference internal" href="#uuid">uuid</a></li>
<li><a class="reference internal" href="#webbrowser">webbrowser</a></li>
<li><a class="reference internal" href="#zipfile">zipfile</a></li>
</ul>
</li>
<li><a class="reference internal" href="#optimizations">Optimizations</a><ul>
<li><a class="reference internal" href="#id2">asyncio</a></li>
<li><a class="reference internal" href="#base64">base64</a></li>
<li><a class="reference internal" href="#bdb">bdb</a></li>
<li><a class="reference internal" href="#id3">difflib</a></li>
<li><a class="reference internal" href="#gc">gc</a></li>
<li><a class="reference internal" href="#id4">io</a></li>
<li><a class="reference internal" href="#id5">pathlib</a></li>
<li><a class="reference internal" href="#id6">pdb</a></li>
<li><a class="reference internal" href="#id7">uuid</a></li>
<li><a class="reference internal" href="#zlib">zlib</a></li>
</ul>
</li>
<li><a class="reference internal" href="#removed">Removed</a><ul>
<li><a class="reference internal" href="#id8">argparse</a></li>
<li><a class="reference internal" href="#id9">ast</a></li>
<li><a class="reference internal" href="#id10">asyncio</a></li>
<li><a class="reference internal" href="#email">email</a></li>
<li><a class="reference internal" href="#importlib-abc">importlib.abc</a></li>
<li><a class="reference internal" href="#itertools">itertools</a></li>
<li><a class="reference internal" href="#id11">pathlib</a></li>
<li><a class="reference internal" href="#pkgutil">pkgutil</a></li>
<li><a class="reference internal" href="#pty">pty</a></li>
<li><a class="reference internal" href="#sqlite3">sqlite3</a></li>
<li><a class="reference internal" href="#id12">urllib</a></li>
</ul>
</li>
<li><a class="reference internal" href="#deprecated">Deprecated</a><ul>
<li><a class="reference internal" href="#new-deprecations">New deprecations</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-15">Pending removal in Python 3.15</a></li>
<li><a class="reference internal" href="#pending-removal-in-python-3-16">Pending removal in Python 3.16</a></li>
<li><a class="reference internal" href="#pending-removal-in-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>
</ul>
</li>
<li><a class="reference internal" href="#cpython-bytecode-changes">CPython bytecode changes</a><ul>
<li><a class="reference internal" href="#pseudo-instructions">Pseudo-instructions</a></li>
</ul>
</li>
<li><a class="reference internal" href="#c-api-changes">C API changes</a><ul>
<li><a class="reference internal" href="#python-configuration-c-api">Python configuration C API</a></li>
<li><a class="reference internal" href="#new-features-in-the-c-api">New features in the C API</a></li>
<li><a class="reference internal" href="#limited-c-api-changes">Limited C API changes</a></li>
<li><a class="reference internal" href="#removed-c-apis">Removed C APIs</a></li>
<li><a class="reference internal" href="#deprecated-c-apis">Deprecated C APIs</a><ul>
<li><a class="reference internal" href="#id13">Pending removal in Python 3.15</a></li>
<li><a class="reference internal" href="#id14">Pending removal in Python 3.16</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="#id15">Pending removal in future versions</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#build-changes">Build changes</a><ul>
<li><a class="reference internal" href="#build-details-json"><code class="file docutils literal notranslate"><span class="pre">build-details.json</span></code></a></li>
<li><a class="reference internal" href="#discontinuation-of-pgp-signatures">Discontinuation of PGP signatures</a></li>
<li><a class="reference internal" href="#free-threaded-python-is-officially-supported">Free-threaded Python is officially supported</a></li>
<li><a class="reference internal" href="#binary-releases-for-the-experimental-just-in-time-compiler">Binary releases for the experimental just-in-time compiler</a></li>
</ul>
</li>
<li><a class="reference internal" href="#porting-to-python-3-14">Porting to Python 3.14</a><ul>
<li><a class="reference internal" href="#changes-in-the-python-api">Changes in the Python API</a></li>
<li><a class="reference internal" href="#changes-in-annotations-pep-649-and-pep-749">Changes in annotations (<strong>PEP 649</strong> and <strong>PEP 749</strong>)</a><ul>
<li><a class="reference internal" href="#implications-for-annotated-code">Implications for annotated code</a></li>
<li><a class="reference internal" href="#implications-for-readers-of-annotations">Implications for readers of <code class="docutils literal notranslate"><span class="pre">__annotations__</span></code></a></li>
<li><a class="reference internal" href="#related-changes">Related changes</a></li>
<li><a class="reference internal" href="#from-future-import-annotations"><code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">__future__</span> <span class="pre">import</span> <span class="pre">annotations</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#changes-in-the-c-api">Changes in the C API</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="index.html"
title="previous chapter">What’s New in Python</a></p>
</div>
<div>
<h4>Next topic</h4>
<p class="topless"><a href="3.13.html"
title="next chapter">What’s New In Python 3.13</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/whatsnew/3.14.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="3.13.html" title="What’s New In Python 3.13"
>next</a> |</li>
<li class="right" >
<a href="index.html" title="What’s New in Python"
>previous</a> |</li>
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>
<li><a href="https://www.python.org/">Python</a> »</li>
<li class="switchers">
<div class="language_switcher_placeholder"></div>
<div class="version_switcher_placeholder"></div>
</li>
<li>
</li>
<li id="cpython-language-and-version">
<a href="../index.html">3.14.0 Documentation</a> »
</li>
<li class="nav-item nav-item-1"><a href="index.html" >What’s New in Python</a> »</li>
<li class="nav-item nav-item-this"><a href="">What’s new in Python 3.14</a></li>
<li class="right">
<div class="inline-search" role="search">
<form class="inline-search" action="../search.html" method="get">
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box">
<input type="submit" value="Go">
</form>
</div>
|
</li>
<li class="right">
<label class="theme-selector-label">
Theme
<select class="theme-selector" oninput="activateTheme(this.value)">
<option value="auto" selected>Auto</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</label> |</li>
</ul>
</div>
<div class="footer">
© <a href="../copyright.html">Copyright</a> 2001 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>