2600 lines
210 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta property="og:title" content="dis — Disassembler for Python bytecode" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://docs.python.org/3/library/dis.html" />
<meta property="og:site_name" content="Python documentation" />
<meta property="og:description" content="Source code: Lib/dis.py The dis module supports the analysis of CPython bytecode by disassembling it. The CPython bytecode which this module takes as an input is defined in the file Include/opcode...." />
<meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
<meta property="og:image:alt" content="Python documentation" />
<meta name="description" content="Source code: Lib/dis.py The dis module supports the analysis of CPython bytecode by disassembling it. The CPython bytecode which this module takes as an input is defined in the file Include/opcode...." />
<meta property="og:image:width" content="200">
<meta property="og:image:height" content="200">
<meta name="theme-color" content="#3776ab">
<title>dis — Disassembler for Python bytecode &#8212; Python 3.13.3 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/pydoctheme.css?v=23252803" />
<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=5d57ca2d"></script>
<script src="../_static/doctools.js?v=9bcbadda"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/sidebar.js"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Python 3.13.3 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="pickletools — Tools for pickle developers" href="pickletools.html" />
<link rel="prev" title="compileall — Byte-compile Python libraries" href="compileall.html" />
<link rel="canonical" href="https://docs.python.org/3/library/dis.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="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">dis</span></code> — Disassembler for Python bytecode</a><ul>
<li><a class="reference internal" href="#command-line-interface">Command-line interface</a></li>
<li><a class="reference internal" href="#bytecode-analysis">Bytecode analysis</a></li>
<li><a class="reference internal" href="#analysis-functions">Analysis functions</a></li>
<li><a class="reference internal" href="#python-bytecode-instructions">Python Bytecode Instructions</a></li>
<li><a class="reference internal" href="#opcode-collections">Opcode collections</a></li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="compileall.html"
title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">compileall</span></code> — Byte-compile Python libraries</a></p>
</div>
<div>
<h4>Next topic</h4>
<p class="topless"><a href="pickletools.html"
title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pickletools</span></code> — Tools for pickle developers</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/library/dis.rst"
rel="nofollow">Show Source
</a>
</li>
</ul>
</div>
</nav>
</div>
</div>
<div class="related" role="navigation" aria-label="Related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="pickletools.html" title="pickletools — Tools for pickle developers"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="compileall.html" title="compileall — Byte-compile Python libraries"
accesskey="P">previous</a> |</li>
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> &#187;</li>
<li class="switchers">
<div class="language_switcher_placeholder"></div>
<div class="version_switcher_placeholder"></div>
</li>
<li>
</li>
<li id="cpython-language-and-version">
<a href="../index.html">3.13.3 Documentation</a> &#187;
</li>
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
<li class="nav-item nav-item-2"><a href="language.html" accesskey="U">Python Language Services</a> &#187;</li>
<li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">dis</span></code> — Disassembler for Python bytecode</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="module-dis">
<span id="dis-disassembler-for-python-bytecode"></span><h1><code class="xref py py-mod docutils literal notranslate"><span class="pre">dis</span></code> — Disassembler for Python bytecode<a class="headerlink" href="#module-dis" title="Link to this heading"></a></h1>
<p><strong>Source code:</strong> <a class="extlink-source reference external" href="https://github.com/python/cpython/tree/3.13/Lib/dis.py">Lib/dis.py</a></p>
<hr class="docutils" />
<p>The <a class="reference internal" href="#module-dis" title="dis: Disassembler for Python bytecode."><code class="xref py py-mod docutils literal notranslate"><span class="pre">dis</span></code></a> module supports the analysis of CPython <a class="reference internal" href="../glossary.html#term-bytecode"><span class="xref std std-term">bytecode</span></a> by
disassembling it. The CPython bytecode which this module takes as an input is
defined in the file <code class="file docutils literal notranslate"><span class="pre">Include/opcode.h</span></code> and used by the compiler and the
interpreter.</p>
<div class="impl-detail compound">
<p><strong>CPython implementation detail:</strong> Bytecode is an implementation detail of the CPython interpreter. No
guarantees are made that bytecode will not be added, removed, or changed
between versions of Python. Use of this module should not be considered to
work across Python VMs or Python releases.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.6: </span>Use 2 bytes for each instruction. Previously the number of bytes varied
by instruction.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.10: </span>The argument of jump, exception handling and loop instructions is now
the instruction offset rather than the byte offset.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>Some instructions are accompanied by one or more inline cache entries,
which take the form of <a class="reference internal" href="#opcode-CACHE"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">CACHE</span></code></a> instructions. These instructions
are hidden by default, but can be shown by passing <code class="docutils literal notranslate"><span class="pre">show_caches=True</span></code> to
any <a class="reference internal" href="#module-dis" title="dis: Disassembler for Python bytecode."><code class="xref py py-mod docutils literal notranslate"><span class="pre">dis</span></code></a> utility. Furthermore, the interpreter now adapts the
bytecode to specialize it for different runtime conditions. The
adaptive bytecode can be shown by passing <code class="docutils literal notranslate"><span class="pre">adaptive=True</span></code>.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.12: </span>The argument of a jump is the offset of the target instruction relative
to the instruction that appears immediately after the jump instructions
<a class="reference internal" href="#opcode-CACHE"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">CACHE</span></code></a> entries.</p>
<p>As a consequence, the presence of the <a class="reference internal" href="#opcode-CACHE"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">CACHE</span></code></a> instructions is
transparent for forward jumps but needs to be taken into account when
reasoning about backward jumps.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>The output shows logical labels rather than instruction offsets
for jump targets and exception handlers. The <code class="docutils literal notranslate"><span class="pre">-O</span></code> command line
option and the <code class="docutils literal notranslate"><span class="pre">show_offsets</span></code> argument were added.</p>
</div>
</div>
<p>Example: Given the function <code class="xref py py-func docutils literal notranslate"><span class="pre">myfunc()</span></code>:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">def</span><span class="w"> </span><span class="nf">myfunc</span><span class="p">(</span><span class="n">alist</span><span class="p">):</span>
<span class="k">return</span> <span class="nb">len</span><span class="p">(</span><span class="n">alist</span><span class="p">)</span>
</pre></div>
</div>
<p>the following command can be used to display the disassembly of
<code class="xref py py-func docutils literal notranslate"><span class="pre">myfunc()</span></code>:</p>
<div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">dis</span><span class="o">.</span><span class="n">dis</span><span class="p">(</span><span class="n">myfunc</span><span class="p">)</span>
<span class="go"> 2 RESUME 0</span>
<span class="go"> 3 LOAD_GLOBAL 1 (len + NULL)</span>
<span class="go"> LOAD_FAST 0 (alist)</span>
<span class="go"> CALL 1</span>
<span class="go"> RETURN_VALUE</span>
</pre></div>
</div>
<p>(The “2” is a line number).</p>
<section id="command-line-interface">
<span id="dis-cli"></span><h2>Command-line interface<a class="headerlink" href="#command-line-interface" title="Link to this heading"></a></h2>
<p>The <a class="reference internal" href="#module-dis" title="dis: Disassembler for Python bytecode."><code class="xref py py-mod docutils literal notranslate"><span class="pre">dis</span></code></a> module can be invoked as a script from the command line:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>python<span class="w"> </span>-m<span class="w"> </span>dis<span class="w"> </span><span class="o">[</span>-h<span class="o">]</span><span class="w"> </span><span class="o">[</span>-C<span class="o">]</span><span class="w"> </span><span class="o">[</span>-O<span class="o">]</span><span class="w"> </span><span class="o">[</span>infile<span class="o">]</span>
</pre></div>
</div>
<p>The following options are accepted:</p>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-dis-h">
<span id="cmdoption-dis-help"></span><span class="sig-name descname"><span class="pre">-h</span></span><span class="sig-prename descclassname"></span><span class="sig-prename descclassname"><span class="pre">,</span> </span><span class="sig-name descname"><span class="pre">--help</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-dis-h" title="Link to this definition"></a></dt>
<dd><p>Display usage and exit.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-dis-C">
<span id="cmdoption-dis-show-caches"></span><span class="sig-name descname"><span class="pre">-C</span></span><span class="sig-prename descclassname"></span><span class="sig-prename descclassname"><span class="pre">,</span> </span><span class="sig-name descname"><span class="pre">--show-caches</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-dis-C" title="Link to this definition"></a></dt>
<dd><p>Show inline caches.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-dis-O">
<span id="cmdoption-dis-show-offsets"></span><span class="sig-name descname"><span class="pre">-O</span></span><span class="sig-prename descclassname"></span><span class="sig-prename descclassname"><span class="pre">,</span> </span><span class="sig-name descname"><span class="pre">--show-offsets</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-dis-O" title="Link to this definition"></a></dt>
<dd><p>Show offsets of instructions.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
<p>If <code class="file docutils literal notranslate"><span class="pre">infile</span></code> is specified, its disassembled code will be written to stdout.
Otherwise, disassembly is performed on compiled source code received from stdin.</p>
</section>
<section id="bytecode-analysis">
<h2>Bytecode analysis<a class="headerlink" href="#bytecode-analysis" title="Link to this heading"></a></h2>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.4.</span></p>
</div>
<p>The bytecode analysis API allows pieces of Python code to be wrapped in a
<a class="reference internal" href="#dis.Bytecode" title="dis.Bytecode"><code class="xref py py-class docutils literal notranslate"><span class="pre">Bytecode</span></code></a> object that provides easy access to details of the compiled
code.</p>
<dl class="py class">
<dt class="sig sig-object py" id="dis.Bytecode">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">Bytecode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="keyword-only-separator o"><abbr title="Keyword-only parameters separator (PEP 3102)"><span class="pre">*</span></abbr></span></em>, <em class="sig-param"><span class="n"><span class="pre">first_line</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">current_offset</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">show_caches</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">adaptive</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">show_offsets</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#dis.Bytecode" title="Link to this definition"></a></dt>
<dd><p>Analyse the bytecode corresponding to a function, generator, asynchronous
generator, coroutine, method, string of source code, or a code object (as
returned by <a class="reference internal" href="functions.html#compile" title="compile"><code class="xref py py-func docutils literal notranslate"><span class="pre">compile()</span></code></a>).</p>
<p>This is a convenience wrapper around many of the functions listed below, most
notably <a class="reference internal" href="#dis.get_instructions" title="dis.get_instructions"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_instructions()</span></code></a>, as iterating over a <a class="reference internal" href="#dis.Bytecode" title="dis.Bytecode"><code class="xref py py-class docutils literal notranslate"><span class="pre">Bytecode</span></code></a>
instance yields the bytecode operations as <a class="reference internal" href="#dis.Instruction" title="dis.Instruction"><code class="xref py py-class docutils literal notranslate"><span class="pre">Instruction</span></code></a> instances.</p>
<p>If <em>first_line</em> is not <code class="docutils literal notranslate"><span class="pre">None</span></code>, it indicates the line number that should be
reported for the first source line in the disassembled code. Otherwise, the
source line information (if any) is taken directly from the disassembled code
object.</p>
<p>If <em>current_offset</em> is not <code class="docutils literal notranslate"><span class="pre">None</span></code>, it refers to an instruction offset in the
disassembled code. Setting this means <a class="reference internal" href="#dis.Bytecode.dis" title="dis.Bytecode.dis"><code class="xref py py-meth docutils literal notranslate"><span class="pre">dis()</span></code></a> will display a “current
instruction” marker against the specified opcode.</p>
<p>If <em>show_caches</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, <a class="reference internal" href="#dis.Bytecode.dis" title="dis.Bytecode.dis"><code class="xref py py-meth docutils literal notranslate"><span class="pre">dis()</span></code></a> will display inline cache
entries used by the interpreter to specialize the bytecode.</p>
<p>If <em>adaptive</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, <a class="reference internal" href="#dis.Bytecode.dis" title="dis.Bytecode.dis"><code class="xref py py-meth docutils literal notranslate"><span class="pre">dis()</span></code></a> will display specialized bytecode
that may be different from the original bytecode.</p>
<p>If <em>show_offsets</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, <a class="reference internal" href="#dis.Bytecode.dis" title="dis.Bytecode.dis"><code class="xref py py-meth docutils literal notranslate"><span class="pre">dis()</span></code></a> will include instruction
offsets in the output.</p>
<dl class="py method">
<dt class="sig sig-object py" id="dis.Bytecode.from_traceback">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_traceback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tb</span></span></em>, <em class="sig-param"><span class="keyword-only-separator o"><abbr title="Keyword-only parameters separator (PEP 3102)"><span class="pre">*</span></abbr></span></em>, <em class="sig-param"><span class="n"><span class="pre">show_caches</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#dis.Bytecode.from_traceback" title="Link to this definition"></a></dt>
<dd><p>Construct a <a class="reference internal" href="#dis.Bytecode" title="dis.Bytecode"><code class="xref py py-class docutils literal notranslate"><span class="pre">Bytecode</span></code></a> instance from the given traceback, setting
<em>current_offset</em> to the instruction responsible for the exception.</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Bytecode.codeobj">
<span class="sig-name descname"><span class="pre">codeobj</span></span><a class="headerlink" href="#dis.Bytecode.codeobj" title="Link to this definition"></a></dt>
<dd><p>The compiled code object.</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Bytecode.first_line">
<span class="sig-name descname"><span class="pre">first_line</span></span><a class="headerlink" href="#dis.Bytecode.first_line" title="Link to this definition"></a></dt>
<dd><p>The first source line of the code object (if available)</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="dis.Bytecode.dis">
<span class="sig-name descname"><span class="pre">dis</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#dis.Bytecode.dis" title="Link to this definition"></a></dt>
<dd><p>Return a formatted view of the bytecode operations (the same as printed by
<a class="reference internal" href="#dis.dis" title="dis.dis"><code class="xref py py-func docutils literal notranslate"><span class="pre">dis.dis()</span></code></a>, but returned as a multi-line string).</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="dis.Bytecode.info">
<span class="sig-name descname"><span class="pre">info</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#dis.Bytecode.info" title="Link to this definition"></a></dt>
<dd><p>Return a formatted multi-line string with detailed information about the
code object, like <a class="reference internal" href="#dis.code_info" title="dis.code_info"><code class="xref py py-func docutils literal notranslate"><span class="pre">code_info()</span></code></a>.</p>
</dd></dl>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.7: </span>This can now handle coroutine and asynchronous generator objects.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>Added the <em>show_caches</em> and <em>adaptive</em> parameters.</p>
</div>
</dd></dl>
<p>Example:</p>
<div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">bytecode</span> <span class="o">=</span> <span class="n">dis</span><span class="o">.</span><span class="n">Bytecode</span><span class="p">(</span><span class="n">myfunc</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">for</span> <span class="n">instr</span> <span class="ow">in</span> <span class="n">bytecode</span><span class="p">:</span>
<span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="n">instr</span><span class="o">.</span><span class="n">opname</span><span class="p">)</span>
<span class="gp">...</span>
<span class="go">RESUME</span>
<span class="go">LOAD_GLOBAL</span>
<span class="go">LOAD_FAST</span>
<span class="go">CALL</span>
<span class="go">RETURN_VALUE</span>
</pre></div>
</div>
</section>
<section id="analysis-functions">
<h2>Analysis functions<a class="headerlink" href="#analysis-functions" title="Link to this heading"></a></h2>
<p>The <a class="reference internal" href="#module-dis" title="dis: Disassembler for Python bytecode."><code class="xref py py-mod docutils literal notranslate"><span class="pre">dis</span></code></a> module also defines the following analysis functions that convert
the input directly to the desired output. They can be useful if only a single
operation is being performed, so the intermediate analysis object isnt useful:</p>
<dl class="py function">
<dt class="sig sig-object py" id="dis.code_info">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">code_info</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#dis.code_info" title="Link to this definition"></a></dt>
<dd><p>Return a formatted multi-line string with detailed code object information
for the supplied function, generator, asynchronous generator, coroutine,
method, source code string or code object.</p>
<p>Note that the exact contents of code info strings are highly implementation
dependent and they may change arbitrarily across Python VMs or Python
releases.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.2.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.7: </span>This can now handle coroutine and asynchronous generator objects.</p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="dis.show_code">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">show_code</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="keyword-only-separator o"><abbr title="Keyword-only parameters separator (PEP 3102)"><span class="pre">*</span></abbr></span></em>, <em class="sig-param"><span class="n"><span class="pre">file</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#dis.show_code" title="Link to this definition"></a></dt>
<dd><p>Print detailed code object information for the supplied function, method,
source code string or code object to <em>file</em> (or <code class="docutils literal notranslate"><span class="pre">sys.stdout</span></code> if <em>file</em>
is not specified).</p>
<p>This is a convenient shorthand for <code class="docutils literal notranslate"><span class="pre">print(code_info(x),</span> <span class="pre">file=file)</span></code>,
intended for interactive exploration at the interpreter prompt.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.2.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.4: </span>Added <em>file</em> parameter.</p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="dis.dis">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">dis</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="keyword-only-separator o"><abbr title="Keyword-only parameters separator (PEP 3102)"><span class="pre">*</span></abbr></span></em>, <em class="sig-param"><span class="n"><span class="pre">file</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">depth</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">show_caches</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">adaptive</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#dis.dis" title="Link to this definition"></a></dt>
<dd><p>Disassemble the <em>x</em> object. <em>x</em> can denote either a module, a class, a
method, a function, a generator, an asynchronous generator, a coroutine,
a code object, a string of source code or a byte sequence of raw bytecode.
For a module, it disassembles all functions. For a class, it disassembles
all methods (including class and static methods). For a code object or
sequence of raw bytecode, it prints one line per bytecode instruction.
It also recursively disassembles nested code objects. These can include
generator expressions, nested functions, the bodies of nested classes,
and the code objects used for <a class="reference internal" href="../reference/executionmodel.html#annotation-scopes"><span class="std std-ref">annotation scopes</span></a>.
Strings are first compiled to code objects with the <a class="reference internal" href="functions.html#compile" title="compile"><code class="xref py py-func docutils literal notranslate"><span class="pre">compile()</span></code></a>
built-in function before being disassembled. If no object is provided, this
function disassembles the last traceback.</p>
<p>The disassembly is written as text to the supplied <em>file</em> argument if
provided and to <code class="docutils literal notranslate"><span class="pre">sys.stdout</span></code> otherwise.</p>
<p>The maximal depth of recursion is limited by <em>depth</em> unless it is <code class="docutils literal notranslate"><span class="pre">None</span></code>.
<code class="docutils literal notranslate"><span class="pre">depth=0</span></code> means no recursion.</p>
<p>If <em>show_caches</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, this function will display inline cache
entries used by the interpreter to specialize the bytecode.</p>
<p>If <em>adaptive</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, this function will display specialized bytecode
that may be different from the original bytecode.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.4: </span>Added <em>file</em> parameter.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.7: </span>Implemented recursive disassembling and added <em>depth</em> parameter.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.7: </span>This can now handle coroutine and asynchronous generator objects.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>Added the <em>show_caches</em> and <em>adaptive</em> parameters.</p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">distb(tb=None,</span> <span class="pre">*,</span> <span class="pre">file=None,</span> <span class="pre">show_caches=False,</span> <span class="pre">adaptive=False,</span></span></dt>
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">show_offset=False)</span></span></dt>
<dd><p>Disassemble the top-of-stack function of a traceback, using the last
traceback if none was passed. The instruction causing the exception is
indicated.</p>
<p>The disassembly is written as text to the supplied <em>file</em> argument if
provided and to <code class="docutils literal notranslate"><span class="pre">sys.stdout</span></code> otherwise.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.4: </span>Added <em>file</em> parameter.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>Added the <em>show_caches</em> and <em>adaptive</em> parameters.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>Added the <em>show_offsets</em> parameter.</p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="dis.disassemble">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">disassemble</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">code</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">lasti</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em>, <em class="sig-param"><span class="keyword-only-separator o"><abbr title="Keyword-only parameters separator (PEP 3102)"><span class="pre">*</span></abbr></span></em>, <em class="sig-param"><span class="n"><span class="pre">file</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">show_caches</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">adaptive</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#dis.disassemble" title="Link to this definition"></a></dt>
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">disco(code,</span> <span class="pre">lasti=-1,</span> <span class="pre">*,</span> <span class="pre">file=None,</span> <span class="pre">show_caches=False,</span> <span class="pre">adaptive=False,</span></span></dt>
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">show_offsets=False)</span></span></dt>
<dd><p>Disassemble a code object, indicating the last instruction if <em>lasti</em> was
provided. The output is divided in the following columns:</p>
<ol class="arabic simple">
<li><p>the line number, for the first instruction of each line</p></li>
<li><p>the current instruction, indicated as <code class="docutils literal notranslate"><span class="pre">--&gt;</span></code>,</p></li>
<li><p>a labelled instruction, indicated with <code class="docutils literal notranslate"><span class="pre">&gt;&gt;</span></code>,</p></li>
<li><p>the address of the instruction,</p></li>
<li><p>the operation code name,</p></li>
<li><p>operation parameters, and</p></li>
<li><p>interpretation of the parameters in parentheses.</p></li>
</ol>
<p>The parameter interpretation recognizes local and global variable names,
constant values, branch targets, and compare operators.</p>
<p>The disassembly is written as text to the supplied <em>file</em> argument if
provided and to <code class="docutils literal notranslate"><span class="pre">sys.stdout</span></code> otherwise.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.4: </span>Added <em>file</em> parameter.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>Added the <em>show_caches</em> and <em>adaptive</em> parameters.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>Added the <em>show_offsets</em> parameter.</p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="dis.get_instructions">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">get_instructions</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="keyword-only-separator o"><abbr title="Keyword-only parameters separator (PEP 3102)"><span class="pre">*</span></abbr></span></em>, <em class="sig-param"><span class="n"><span class="pre">first_line</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">show_caches</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">adaptive</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#dis.get_instructions" title="Link to this definition"></a></dt>
<dd><p>Return an iterator over the instructions in the supplied function, method,
source code string or code object.</p>
<p>The iterator generates a series of <a class="reference internal" href="#dis.Instruction" title="dis.Instruction"><code class="xref py py-class docutils literal notranslate"><span class="pre">Instruction</span></code></a> named tuples giving
the details of each operation in the supplied code.</p>
<p>If <em>first_line</em> is not <code class="docutils literal notranslate"><span class="pre">None</span></code>, it indicates the line number that should be
reported for the first source line in the disassembled code. Otherwise, the
source line information (if any) is taken directly from the disassembled code
object.</p>
<p>The <em>adaptive</em> parameter works as it does in <a class="reference internal" href="#module-dis" title="dis: Disassembler for Python bytecode."><code class="xref py py-func docutils literal notranslate"><span class="pre">dis()</span></code></a>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.4.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>Added the <em>show_caches</em> and <em>adaptive</em> parameters.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>The <em>show_caches</em> parameter is deprecated and has no effect. The iterator
generates the <a class="reference internal" href="#dis.Instruction" title="dis.Instruction"><code class="xref py py-class docutils literal notranslate"><span class="pre">Instruction</span></code></a> instances with the <em>cache_info</em>
field populated (regardless of the value of <em>show_caches</em>) and it no longer
generates separate items for the cache entries.</p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="dis.findlinestarts">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">findlinestarts</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">code</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#dis.findlinestarts" title="Link to this definition"></a></dt>
<dd><p>This generator function uses 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">co_lines()</span></code></a> method
of the <a class="reference internal" href="../reference/datamodel.html#code-objects"><span class="std std-ref">code object</span></a> <em>code</em> to find the offsets which
are starts of
lines in the source code. They are generated as <code class="docutils literal notranslate"><span class="pre">(offset,</span> <span class="pre">lineno)</span></code> pairs.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.6: </span>Line numbers can be decreasing. Before, they were always increasing.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.10: </span>The <span class="target" id="index-0"></span><a class="pep reference external" href="https://peps.python.org/pep-0626/"><strong>PEP 626</strong></a> <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">co_lines()</span></code></a> method is used instead of the
<a class="reference internal" href="../reference/datamodel.html#codeobject.co_firstlineno" title="codeobject.co_firstlineno"><code class="xref py py-attr docutils literal notranslate"><span class="pre">co_firstlineno</span></code></a> and <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>
attributes of the <a class="reference internal" href="../reference/datamodel.html#code-objects"><span class="std std-ref">code object</span></a>.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>Line numbers can be <code class="docutils literal notranslate"><span class="pre">None</span></code> for bytecode that does not map to source lines.</p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="dis.findlabels">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">findlabels</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">code</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#dis.findlabels" title="Link to this definition"></a></dt>
<dd><p>Detect all offsets in the raw compiled bytecode string <em>code</em> which are jump targets, and
return a list of these offsets.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="dis.stack_effect">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">stack_effect</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opcode</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">oparg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="keyword-only-separator o"><abbr title="Keyword-only parameters separator (PEP 3102)"><span class="pre">*</span></abbr></span></em>, <em class="sig-param"><span class="n"><span class="pre">jump</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#dis.stack_effect" title="Link to this definition"></a></dt>
<dd><p>Compute the stack effect of <em>opcode</em> with argument <em>oparg</em>.</p>
<p>If the code has a jump target and <em>jump</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, <a class="reference internal" href="#dis.stack_effect" title="dis.stack_effect"><code class="xref py py-func docutils literal notranslate"><span class="pre">stack_effect()</span></code></a>
will return the stack effect of jumping. If <em>jump</em> is <code class="docutils literal notranslate"><span class="pre">False</span></code>,
it will return the stack effect of not jumping. And if <em>jump</em> is
<code class="docutils literal notranslate"><span class="pre">None</span></code> (default), it will return the maximal stack effect of both cases.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.4.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.8: </span>Added <em>jump</em> parameter.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>If <code class="docutils literal notranslate"><span class="pre">oparg</span></code> is omitted (or <code class="docutils literal notranslate"><span class="pre">None</span></code>), the stack effect is now returned
for <code class="docutils literal notranslate"><span class="pre">oparg=0</span></code>. Previously this was an error for opcodes that use their
arg. It is also no longer an error to pass an integer <code class="docutils literal notranslate"><span class="pre">oparg</span></code> when
the <code class="docutils literal notranslate"><span class="pre">opcode</span></code> does not use it; the <code class="docutils literal notranslate"><span class="pre">oparg</span></code> in this case is ignored.</p>
</div>
</dd></dl>
</section>
<section id="python-bytecode-instructions">
<span id="bytecodes"></span><h2>Python Bytecode Instructions<a class="headerlink" href="#python-bytecode-instructions" title="Link to this heading"></a></h2>
<p>The <a class="reference internal" href="#dis.get_instructions" title="dis.get_instructions"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_instructions()</span></code></a> function and <a class="reference internal" href="#dis.Bytecode" title="dis.Bytecode"><code class="xref py py-class docutils literal notranslate"><span class="pre">Bytecode</span></code></a> class provide
details of bytecode instructions as <a class="reference internal" href="#dis.Instruction" title="dis.Instruction"><code class="xref py py-class docutils literal notranslate"><span class="pre">Instruction</span></code></a> instances:</p>
<dl class="py class">
<dt class="sig sig-object py" id="dis.Instruction">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">Instruction</span></span><a class="headerlink" href="#dis.Instruction" title="Link to this definition"></a></dt>
<dd><p>Details for a bytecode operation</p>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.opcode">
<span class="sig-name descname"><span class="pre">opcode</span></span><a class="headerlink" href="#dis.Instruction.opcode" title="Link to this definition"></a></dt>
<dd><p>numeric code for operation, corresponding to the opcode values listed
below and the bytecode values in the <a class="reference internal" href="#opcode-collections"><span class="std std-ref">Opcode collections</span></a>.</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.opname">
<span class="sig-name descname"><span class="pre">opname</span></span><a class="headerlink" href="#dis.Instruction.opname" title="Link to this definition"></a></dt>
<dd><p>human readable name for operation</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.baseopcode">
<span class="sig-name descname"><span class="pre">baseopcode</span></span><a class="headerlink" href="#dis.Instruction.baseopcode" title="Link to this definition"></a></dt>
<dd><p>numeric code for the base operation if operation is specialized;
otherwise equal to <a class="reference internal" href="#dis.Instruction.opcode" title="dis.Instruction.opcode"><code class="xref py py-data docutils literal notranslate"><span class="pre">opcode</span></code></a></p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.baseopname">
<span class="sig-name descname"><span class="pre">baseopname</span></span><a class="headerlink" href="#dis.Instruction.baseopname" title="Link to this definition"></a></dt>
<dd><p>human readable name for the base operation if operation is specialized;
otherwise equal to <a class="reference internal" href="#dis.opname" title="dis.opname"><code class="xref py py-data docutils literal notranslate"><span class="pre">opname</span></code></a></p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.arg">
<span class="sig-name descname"><span class="pre">arg</span></span><a class="headerlink" href="#dis.Instruction.arg" title="Link to this definition"></a></dt>
<dd><p>numeric argument to operation (if any), otherwise <code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.oparg">
<span class="sig-name descname"><span class="pre">oparg</span></span><a class="headerlink" href="#dis.Instruction.oparg" title="Link to this definition"></a></dt>
<dd><p>alias for <a class="reference internal" href="#dis.Instruction.arg" title="dis.Instruction.arg"><code class="xref py py-data docutils literal notranslate"><span class="pre">arg</span></code></a></p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.argval">
<span class="sig-name descname"><span class="pre">argval</span></span><a class="headerlink" href="#dis.Instruction.argval" title="Link to this definition"></a></dt>
<dd><p>resolved arg value (if any), otherwise <code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.argrepr">
<span class="sig-name descname"><span class="pre">argrepr</span></span><a class="headerlink" href="#dis.Instruction.argrepr" title="Link to this definition"></a></dt>
<dd><p>human readable description of operation argument (if any),
otherwise an empty string.</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.offset">
<span class="sig-name descname"><span class="pre">offset</span></span><a class="headerlink" href="#dis.Instruction.offset" title="Link to this definition"></a></dt>
<dd><p>start index of operation within bytecode sequence</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.start_offset">
<span class="sig-name descname"><span class="pre">start_offset</span></span><a class="headerlink" href="#dis.Instruction.start_offset" title="Link to this definition"></a></dt>
<dd><p>start index of operation within bytecode sequence, including prefixed
<code class="docutils literal notranslate"><span class="pre">EXTENDED_ARG</span></code> operations if present; otherwise equal to <a class="reference internal" href="#dis.Instruction.offset" title="dis.Instruction.offset"><code class="xref py py-data docutils literal notranslate"><span class="pre">offset</span></code></a></p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.cache_offset">
<span class="sig-name descname"><span class="pre">cache_offset</span></span><a class="headerlink" href="#dis.Instruction.cache_offset" title="Link to this definition"></a></dt>
<dd><p>start index of the cache entries following the operation</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.end_offset">
<span class="sig-name descname"><span class="pre">end_offset</span></span><a class="headerlink" href="#dis.Instruction.end_offset" title="Link to this definition"></a></dt>
<dd><p>end index of the cache entries following the operation</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.starts_line">
<span class="sig-name descname"><span class="pre">starts_line</span></span><a class="headerlink" href="#dis.Instruction.starts_line" title="Link to this definition"></a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">True</span></code> if this opcode starts a source line, otherwise <code class="docutils literal notranslate"><span class="pre">False</span></code></p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.line_number">
<span class="sig-name descname"><span class="pre">line_number</span></span><a class="headerlink" href="#dis.Instruction.line_number" title="Link to this definition"></a></dt>
<dd><p>source line number associated with this opcode (if any), otherwise <code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.is_jump_target">
<span class="sig-name descname"><span class="pre">is_jump_target</span></span><a class="headerlink" href="#dis.Instruction.is_jump_target" title="Link to this definition"></a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">True</span></code> if other code jumps to here, otherwise <code class="docutils literal notranslate"><span class="pre">False</span></code></p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.jump_target">
<span class="sig-name descname"><span class="pre">jump_target</span></span><a class="headerlink" href="#dis.Instruction.jump_target" title="Link to this definition"></a></dt>
<dd><p>bytecode index of the jump target if this is a jump operation,
otherwise <code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.positions">
<span class="sig-name descname"><span class="pre">positions</span></span><a class="headerlink" href="#dis.Instruction.positions" title="Link to this definition"></a></dt>
<dd><p><a class="reference internal" href="#dis.Positions" title="dis.Positions"><code class="xref py py-class docutils literal notranslate"><span class="pre">dis.Positions</span></code></a> object holding the
start and end locations that are covered by this instruction.</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Instruction.cache_info">
<span class="sig-name descname"><span class="pre">cache_info</span></span><a class="headerlink" href="#dis.Instruction.cache_info" title="Link to this definition"></a></dt>
<dd><p>Information about the cache entries of this instruction, as
triplets of the form <code class="docutils literal notranslate"><span class="pre">(name,</span> <span class="pre">size,</span> <span class="pre">data)</span></code>, where the <code class="docutils literal notranslate"><span class="pre">name</span></code>
and <code class="docutils literal notranslate"><span class="pre">size</span></code> describe the cache format and data is the contents
of the cache. <code class="docutils literal notranslate"><span class="pre">cache_info</span></code> is <code class="docutils literal notranslate"><span class="pre">None</span></code> if the instruction does not have
caches.</p>
</dd></dl>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.4.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>Field <code class="docutils literal notranslate"><span class="pre">positions</span></code> is added.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>Changed field <code class="docutils literal notranslate"><span class="pre">starts_line</span></code>.</p>
<p>Added fields <code class="docutils literal notranslate"><span class="pre">start_offset</span></code>, <code class="docutils literal notranslate"><span class="pre">cache_offset</span></code>, <code class="docutils literal notranslate"><span class="pre">end_offset</span></code>,
<code class="docutils literal notranslate"><span class="pre">baseopname</span></code>, <code class="docutils literal notranslate"><span class="pre">baseopcode</span></code>, <code class="docutils literal notranslate"><span class="pre">jump_target</span></code>, <code class="docutils literal notranslate"><span class="pre">oparg</span></code>,
<code class="docutils literal notranslate"><span class="pre">line_number</span></code> and <code class="docutils literal notranslate"><span class="pre">cache_info</span></code>.</p>
</div>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="dis.Positions">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">Positions</span></span><a class="headerlink" href="#dis.Positions" title="Link to this definition"></a></dt>
<dd><p>In case the information is not available, some fields might be <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Positions.lineno">
<span class="sig-name descname"><span class="pre">lineno</span></span><a class="headerlink" href="#dis.Positions.lineno" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Positions.end_lineno">
<span class="sig-name descname"><span class="pre">end_lineno</span></span><a class="headerlink" href="#dis.Positions.end_lineno" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Positions.col_offset">
<span class="sig-name descname"><span class="pre">col_offset</span></span><a class="headerlink" href="#dis.Positions.col_offset" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.Positions.end_col_offset">
<span class="sig-name descname"><span class="pre">end_col_offset</span></span><a class="headerlink" href="#dis.Positions.end_col_offset" title="Link to this definition"></a></dt>
<dd></dd></dl>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<p>The Python compiler currently generates the following bytecode instructions.</p>
<p><strong>General instructions</strong></p>
<p>In the following, We will refer to the interpreter stack as <code class="docutils literal notranslate"><span class="pre">STACK</span></code> and describe
operations on it as if it was a Python list. The top of the stack corresponds to
<code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> in this language.</p>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-NOP">
<span class="sig-name descname"><span class="pre">NOP</span></span><a class="headerlink" href="#opcode-NOP" title="Link to this definition"></a></dt>
<dd><p>Do nothing code. Used as a placeholder by the bytecode optimizer, and to
generate line tracing events.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-POP_TOP">
<span class="sig-name descname"><span class="pre">POP_TOP</span></span><a class="headerlink" href="#opcode-POP_TOP" title="Link to this definition"></a></dt>
<dd><p>Removes the top-of-stack item:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
</pre></div>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-END_FOR">
<span class="sig-name descname"><span class="pre">END_FOR</span></span><a class="headerlink" href="#opcode-END_FOR" title="Link to this definition"></a></dt>
<dd><p>Removes the top-of-stack item.
Equivalent to <code class="docutils literal notranslate"><span class="pre">POP_TOP</span></code>.
Used to clean up at the end of loops, hence the name.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-END_SEND">
<span class="sig-name descname"><span class="pre">END_SEND</span></span><a class="headerlink" href="#opcode-END_SEND" title="Link to this definition"></a></dt>
<dd><p>Implements <code class="docutils literal notranslate"><span class="pre">del</span> <span class="pre">STACK[-2]</span></code>.
Used to clean up when a generator exits.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-COPY">
<span class="sig-name descname"><span class="pre">COPY</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-COPY" title="Link to this definition"></a></dt>
<dd><p>Push the i-th item to the top of the stack without removing it from its original
location:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">assert</span> <span class="n">i</span> <span class="o">&gt;</span> <span class="mi">0</span>
<span class="n">STACK</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">STACK</span><span class="p">[</span><span class="o">-</span><span class="n">i</span><span class="p">])</span>
</pre></div>
</div>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-SWAP">
<span class="sig-name descname"><span class="pre">SWAP</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-SWAP" title="Link to this definition"></a></dt>
<dd><p>Swap the top of the stack with the i-th element:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">STACK</span><span class="p">[</span><span class="o">-</span><span class="n">i</span><span class="p">],</span> <span class="n">STACK</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">STACK</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="n">STACK</span><span class="p">[</span><span class="o">-</span><span class="n">i</span><span class="p">]</span>
</pre></div>
</div>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-CACHE">
<span class="sig-name descname"><span class="pre">CACHE</span></span><a class="headerlink" href="#opcode-CACHE" title="Link to this definition"></a></dt>
<dd><p>Rather than being an actual instruction, this opcode is used to mark extra
space for the interpreter to cache useful data directly in the bytecode
itself. It is automatically hidden by all <code class="docutils literal notranslate"><span class="pre">dis</span></code> utilities, but can be
viewed with <code class="docutils literal notranslate"><span class="pre">show_caches=True</span></code>.</p>
<p>Logically, this space is part of the preceding instruction. Many opcodes
expect to be followed by an exact number of caches, and will instruct the
interpreter to skip over them at runtime.</p>
<p>Populated caches can look like arbitrary instructions, so great care should
be taken when reading or modifying raw, adaptive bytecode containing
quickened data.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<p><strong>Unary operations</strong></p>
<p>Unary operations take the top of the stack, apply the operation, and push the
result back on the stack.</p>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-UNARY_NEGATIVE">
<span class="sig-name descname"><span class="pre">UNARY_NEGATIVE</span></span><a class="headerlink" href="#opcode-UNARY_NEGATIVE" title="Link to this definition"></a></dt>
<dd><p>Implements <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span> <span class="pre">=</span> <span class="pre">-STACK[-1]</span></code>.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-UNARY_NOT">
<span class="sig-name descname"><span class="pre">UNARY_NOT</span></span><a class="headerlink" href="#opcode-UNARY_NOT" title="Link to this definition"></a></dt>
<dd><p>Implements <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span> <span class="pre">=</span> <span class="pre">not</span> <span class="pre">STACK[-1]</span></code>.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>This instruction now requires an exact <a class="reference internal" href="functions.html#bool" title="bool"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a> operand.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-UNARY_INVERT">
<span class="sig-name descname"><span class="pre">UNARY_INVERT</span></span><a class="headerlink" href="#opcode-UNARY_INVERT" title="Link to this definition"></a></dt>
<dd><p>Implements <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span> <span class="pre">=</span> <span class="pre">~STACK[-1]</span></code>.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-GET_ITER">
<span class="sig-name descname"><span class="pre">GET_ITER</span></span><a class="headerlink" href="#opcode-GET_ITER" title="Link to this definition"></a></dt>
<dd><p>Implements <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span> <span class="pre">=</span> <span class="pre">iter(STACK[-1])</span></code>.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-GET_YIELD_FROM_ITER">
<span class="sig-name descname"><span class="pre">GET_YIELD_FROM_ITER</span></span><a class="headerlink" href="#opcode-GET_YIELD_FROM_ITER" title="Link to this definition"></a></dt>
<dd><p>If <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is a <a class="reference internal" href="../glossary.html#term-generator-iterator"><span class="xref std std-term">generator iterator</span></a> or <a class="reference internal" href="../glossary.html#term-coroutine"><span class="xref std std-term">coroutine</span></a> object
it is left as is. Otherwise, implements <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span> <span class="pre">=</span> <span class="pre">iter(STACK[-1])</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.5.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-TO_BOOL">
<span class="sig-name descname"><span class="pre">TO_BOOL</span></span><a class="headerlink" href="#opcode-TO_BOOL" title="Link to this definition"></a></dt>
<dd><p>Implements <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span> <span class="pre">=</span> <span class="pre">bool(STACK[-1])</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
<p><strong>Binary and in-place operations</strong></p>
<p>Binary operations remove the top two items from the stack (<code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> and
<code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code>). They perform the operation, then put the result back on the stack.</p>
<p>In-place operations are like binary operations, but the operation is done in-place
when <code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code> supports it, and the resulting <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> may be (but does
not have to be) the original <code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code>.</p>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-BINARY_OP">
<span class="sig-name descname"><span class="pre">BINARY_OP</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">op</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-BINARY_OP" title="Link to this definition"></a></dt>
<dd><p>Implements the binary and in-place operators (depending on the value of
<em>op</em>):</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">rhs</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">lhs</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">STACK</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">lhs</span> <span class="n">op</span> <span class="n">rhs</span><span class="p">)</span>
</pre></div>
</div>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-BINARY_SUBSCR">
<span class="sig-name descname"><span class="pre">BINARY_SUBSCR</span></span><a class="headerlink" href="#opcode-BINARY_SUBSCR" title="Link to this definition"></a></dt>
<dd><p>Implements:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">key</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">container</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">STACK</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">container</span><span class="p">[</span><span class="n">key</span><span class="p">])</span>
</pre></div>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-STORE_SUBSCR">
<span class="sig-name descname"><span class="pre">STORE_SUBSCR</span></span><a class="headerlink" href="#opcode-STORE_SUBSCR" title="Link to this definition"></a></dt>
<dd><p>Implements:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">key</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">container</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">value</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">container</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
</pre></div>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-DELETE_SUBSCR">
<span class="sig-name descname"><span class="pre">DELETE_SUBSCR</span></span><a class="headerlink" href="#opcode-DELETE_SUBSCR" title="Link to this definition"></a></dt>
<dd><p>Implements:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">key</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">container</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="k">del</span> <span class="n">container</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
</pre></div>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-BINARY_SLICE">
<span class="sig-name descname"><span class="pre">BINARY_SLICE</span></span><a class="headerlink" href="#opcode-BINARY_SLICE" title="Link to this definition"></a></dt>
<dd><p>Implements:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">end</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">start</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">container</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">STACK</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">container</span><span class="p">[</span><span class="n">start</span><span class="p">:</span><span class="n">end</span><span class="p">])</span>
</pre></div>
</div>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-STORE_SLICE">
<span class="sig-name descname"><span class="pre">STORE_SLICE</span></span><a class="headerlink" href="#opcode-STORE_SLICE" title="Link to this definition"></a></dt>
<dd><p>Implements:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">end</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">start</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">container</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">values</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">container</span><span class="p">[</span><span class="n">start</span><span class="p">:</span><span class="n">end</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
</pre></div>
</div>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<p><strong>Coroutine opcodes</strong></p>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-GET_AWAITABLE">
<span class="sig-name descname"><span class="pre">GET_AWAITABLE</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">where</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-GET_AWAITABLE" title="Link to this definition"></a></dt>
<dd><p>Implements <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span> <span class="pre">=</span> <span class="pre">get_awaitable(STACK[-1])</span></code>, where <code class="docutils literal notranslate"><span class="pre">get_awaitable(o)</span></code>
returns <code class="docutils literal notranslate"><span class="pre">o</span></code> if <code class="docutils literal notranslate"><span class="pre">o</span></code> is a coroutine object or a generator object with
the <a class="reference internal" href="inspect.html#inspect.CO_ITERABLE_COROUTINE" title="inspect.CO_ITERABLE_COROUTINE"><code class="xref py py-data docutils literal notranslate"><span class="pre">CO_ITERABLE_COROUTINE</span></code></a> flag, or resolves
<code class="docutils literal notranslate"><span class="pre">o.__await__</span></code>.</p>
<blockquote>
<div><p>If the <code class="docutils literal notranslate"><span class="pre">where</span></code> operand is nonzero, it indicates where the instruction
occurs:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">1</span></code>: After a call to <code class="docutils literal notranslate"><span class="pre">__aenter__</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">2</span></code>: After a call to <code class="docutils literal notranslate"><span class="pre">__aexit__</span></code></p></li>
</ul>
</div></blockquote>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.5.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>Previously, this instruction did not have an oparg.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-GET_AITER">
<span class="sig-name descname"><span class="pre">GET_AITER</span></span><a class="headerlink" href="#opcode-GET_AITER" title="Link to this definition"></a></dt>
<dd><p>Implements <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span> <span class="pre">=</span> <span class="pre">STACK[-1].__aiter__()</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.5.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.7: </span>Returning awaitable objects from <code class="docutils literal notranslate"><span class="pre">__aiter__</span></code> is no longer
supported.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-GET_ANEXT">
<span class="sig-name descname"><span class="pre">GET_ANEXT</span></span><a class="headerlink" href="#opcode-GET_ANEXT" title="Link to this definition"></a></dt>
<dd><p>Implement <code class="docutils literal notranslate"><span class="pre">STACK.append(get_awaitable(STACK[-1].__anext__()))</span></code> to the stack.
See <code class="docutils literal notranslate"><span class="pre">GET_AWAITABLE</span></code> for details about <code class="docutils literal notranslate"><span class="pre">get_awaitable</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.5.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-END_ASYNC_FOR">
<span class="sig-name descname"><span class="pre">END_ASYNC_FOR</span></span><a class="headerlink" href="#opcode-END_ASYNC_FOR" title="Link to this definition"></a></dt>
<dd><p>Terminates an <a class="reference internal" href="../reference/compound_stmts.html#async-for"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">async</span> <span class="pre">for</span></code></a> loop. Handles an exception raised
when awaiting a next item. The stack contains the async iterable in
<code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code> and the raised exception in <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code>. Both are popped.
If the exception is not <a class="reference internal" href="exceptions.html#StopAsyncIteration" title="StopAsyncIteration"><code class="xref py py-exc docutils literal notranslate"><span class="pre">StopAsyncIteration</span></code></a>, it is re-raised.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.8.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>Exception representation on the stack now consist of one, not three, items.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-CLEANUP_THROW">
<span class="sig-name descname"><span class="pre">CLEANUP_THROW</span></span><a class="headerlink" href="#opcode-CLEANUP_THROW" title="Link to this definition"></a></dt>
<dd><p>Handles an exception raised during a <a class="reference internal" href="../reference/expressions.html#generator.throw" title="generator.throw"><code class="xref py py-meth docutils literal notranslate"><span class="pre">throw()</span></code></a> or
<a class="reference internal" href="../reference/expressions.html#generator.close" title="generator.close"><code class="xref py py-meth docutils literal notranslate"><span class="pre">close()</span></code></a> call through the current frame. If <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is an
instance of <a class="reference internal" href="exceptions.html#StopIteration" title="StopIteration"><code class="xref py py-exc docutils literal notranslate"><span class="pre">StopIteration</span></code></a>, pop three values from the stack and push
its <code class="docutils literal notranslate"><span class="pre">value</span></code> member. Otherwise, re-raise <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-BEFORE_ASYNC_WITH">
<span class="sig-name descname"><span class="pre">BEFORE_ASYNC_WITH</span></span><a class="headerlink" href="#opcode-BEFORE_ASYNC_WITH" title="Link to this definition"></a></dt>
<dd><p>Resolves <code class="docutils literal notranslate"><span class="pre">__aenter__</span></code> and <code class="docutils literal notranslate"><span class="pre">__aexit__</span></code> from <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code>.
Pushes <code class="docutils literal notranslate"><span class="pre">__aexit__</span></code> and result of <code class="docutils literal notranslate"><span class="pre">__aenter__()</span></code> to the stack:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">STACK</span><span class="o">.</span><span class="n">extend</span><span class="p">((</span><span class="fm">__aexit__</span><span class="p">,</span> <span class="fm">__aenter__</span><span class="p">())</span>
</pre></div>
</div>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.5.</span></p>
</div>
</dd></dl>
<p><strong>Miscellaneous opcodes</strong></p>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-SET_ADD">
<span class="sig-name descname"><span class="pre">SET_ADD</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-SET_ADD" title="Link to this definition"></a></dt>
<dd><p>Implements:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">item</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="nb">set</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">STACK</span><span class="p">[</span><span class="o">-</span><span class="n">i</span><span class="p">],</span> <span class="n">item</span><span class="p">)</span>
</pre></div>
</div>
<p>Used to implement set comprehensions.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LIST_APPEND">
<span class="sig-name descname"><span class="pre">LIST_APPEND</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-LIST_APPEND" title="Link to this definition"></a></dt>
<dd><p>Implements:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">item</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="nb">list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">STACK</span><span class="p">[</span><span class="o">-</span><span class="n">i</span><span class="p">],</span> <span class="n">item</span><span class="p">)</span>
</pre></div>
</div>
<p>Used to implement list comprehensions.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-MAP_ADD">
<span class="sig-name descname"><span class="pre">MAP_ADD</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-MAP_ADD" title="Link to this definition"></a></dt>
<dd><p>Implements:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">value</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">key</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="nb">dict</span><span class="o">.</span><span class="fm">__setitem__</span><span class="p">(</span><span class="n">STACK</span><span class="p">[</span><span class="o">-</span><span class="n">i</span><span class="p">],</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
</pre></div>
</div>
<p>Used to implement dict comprehensions.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.1.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.8: </span>Map value is <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> and map key is <code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code>. Before, those
were reversed.</p>
</div>
</dd></dl>
<p>For all of the <a class="reference internal" href="#opcode-SET_ADD"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">SET_ADD</span></code></a>, <a class="reference internal" href="#opcode-LIST_APPEND"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">LIST_APPEND</span></code></a> and <a class="reference internal" href="#opcode-MAP_ADD"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">MAP_ADD</span></code></a>
instructions, while the added value or key/value pair is popped off, the
container object remains on the stack so that it is available for further
iterations of the loop.</p>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-RETURN_VALUE">
<span class="sig-name descname"><span class="pre">RETURN_VALUE</span></span><a class="headerlink" href="#opcode-RETURN_VALUE" title="Link to this definition"></a></dt>
<dd><p>Returns with <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> to the caller of the function.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-RETURN_CONST">
<span class="sig-name descname"><span class="pre">RETURN_CONST</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">consti</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-RETURN_CONST" title="Link to this definition"></a></dt>
<dd><p>Returns with <code class="docutils literal notranslate"><span class="pre">co_consts[consti]</span></code> to the caller of the function.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-YIELD_VALUE">
<span class="sig-name descname"><span class="pre">YIELD_VALUE</span></span><a class="headerlink" href="#opcode-YIELD_VALUE" title="Link to this definition"></a></dt>
<dd><p>Yields <code class="docutils literal notranslate"><span class="pre">STACK.pop()</span></code> from a <a class="reference internal" href="../glossary.html#term-generator"><span class="xref std std-term">generator</span></a>.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>oparg set to be the stack depth.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.12: </span>oparg set to be the exception block depth, for efficient closing of generators.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>oparg is <code class="docutils literal notranslate"><span class="pre">1</span></code> if this instruction is part of a yield-from or await, and <code class="docutils literal notranslate"><span class="pre">0</span></code>
otherwise.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-SETUP_ANNOTATIONS">
<span class="sig-name descname"><span class="pre">SETUP_ANNOTATIONS</span></span><a class="headerlink" href="#opcode-SETUP_ANNOTATIONS" title="Link to this definition"></a></dt>
<dd><p>Checks whether <code class="docutils literal notranslate"><span class="pre">__annotations__</span></code> is defined in <code class="docutils literal notranslate"><span class="pre">locals()</span></code>, if not it is
set up to an empty <code class="docutils literal notranslate"><span class="pre">dict</span></code>. This opcode is only emitted if a class
or module body contains <a class="reference internal" href="../glossary.html#term-variable-annotation"><span class="xref std std-term">variable annotations</span></a>
statically.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.6.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-POP_EXCEPT">
<span class="sig-name descname"><span class="pre">POP_EXCEPT</span></span><a class="headerlink" href="#opcode-POP_EXCEPT" title="Link to this definition"></a></dt>
<dd><p>Pops a value from the stack, which is used to restore the exception state.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>Exception representation on the stack now consist of one, not three, items.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-RERAISE">
<span class="sig-name descname"><span class="pre">RERAISE</span></span><a class="headerlink" href="#opcode-RERAISE" title="Link to this definition"></a></dt>
<dd><p>Re-raises the exception currently on top of the stack. If oparg is non-zero,
pops an additional value from the stack which is used to set
<a class="reference internal" href="../reference/datamodel.html#frame.f_lasti" title="frame.f_lasti"><code class="xref py py-attr docutils literal notranslate"><span class="pre">f_lasti</span></code></a> of the current frame.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>Exception representation on the stack now consist of one, not three, items.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-PUSH_EXC_INFO">
<span class="sig-name descname"><span class="pre">PUSH_EXC_INFO</span></span><a class="headerlink" href="#opcode-PUSH_EXC_INFO" title="Link to this definition"></a></dt>
<dd><p>Pops a value from the stack. Pushes the current exception to the top of the stack.
Pushes the value originally popped back to the stack.
Used in exception handlers.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-CHECK_EXC_MATCH">
<span class="sig-name descname"><span class="pre">CHECK_EXC_MATCH</span></span><a class="headerlink" href="#opcode-CHECK_EXC_MATCH" title="Link to this definition"></a></dt>
<dd><p>Performs exception matching for <code class="docutils literal notranslate"><span class="pre">except</span></code>. Tests whether the <code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code>
is an exception matching <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code>. Pops <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> and pushes the boolean
result of the test.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-CHECK_EG_MATCH">
<span class="sig-name descname"><span class="pre">CHECK_EG_MATCH</span></span><a class="headerlink" href="#opcode-CHECK_EG_MATCH" title="Link to this definition"></a></dt>
<dd><p>Performs exception matching for <code class="docutils literal notranslate"><span class="pre">except*</span></code>. Applies <code class="docutils literal notranslate"><span class="pre">split(STACK[-1])</span></code> on
the exception group representing <code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code>.</p>
<p>In case of a match, pops two items from the stack and pushes the
non-matching subgroup (<code class="docutils literal notranslate"><span class="pre">None</span></code> in case of full match) followed by the
matching subgroup. When there is no match, pops one item (the match
type) and pushes <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-WITH_EXCEPT_START">
<span class="sig-name descname"><span class="pre">WITH_EXCEPT_START</span></span><a class="headerlink" href="#opcode-WITH_EXCEPT_START" title="Link to this definition"></a></dt>
<dd><p>Calls the function in position 4 on the stack with arguments (type, val, tb)
representing the exception at the top of the stack.
Used to implement the call <code class="docutils literal notranslate"><span class="pre">context_manager.__exit__(*exc_info())</span></code> when an exception
has occurred in a <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> statement.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>The <code class="docutils literal notranslate"><span class="pre">__exit__</span></code> function is in position 4 of the stack rather than 7.
Exception representation on the stack now consist of one, not three, items.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_ASSERTION_ERROR">
<span class="sig-name descname"><span class="pre">LOAD_ASSERTION_ERROR</span></span><a class="headerlink" href="#opcode-LOAD_ASSERTION_ERROR" title="Link to this definition"></a></dt>
<dd><p>Pushes <a class="reference internal" href="exceptions.html#AssertionError" title="AssertionError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">AssertionError</span></code></a> onto the stack. Used by the <a class="reference internal" href="../reference/simple_stmts.html#assert"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">assert</span></code></a>
statement.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_BUILD_CLASS">
<span class="sig-name descname"><span class="pre">LOAD_BUILD_CLASS</span></span><a class="headerlink" href="#opcode-LOAD_BUILD_CLASS" title="Link to this definition"></a></dt>
<dd><p>Pushes <code class="xref py py-func docutils literal notranslate"><span class="pre">builtins.__build_class__()</span></code> onto the stack. It is later called
to construct a class.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-BEFORE_WITH">
<span class="sig-name descname"><span class="pre">BEFORE_WITH</span></span><a class="headerlink" href="#opcode-BEFORE_WITH" title="Link to this definition"></a></dt>
<dd><p>This opcode performs several operations before a with block starts. First,
it loads <a class="reference internal" href="../reference/datamodel.html#object.__exit__" title="object.__exit__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__exit__()</span></code></a> from the context manager and pushes it onto
the stack for later use by <a class="reference internal" href="#opcode-WITH_EXCEPT_START"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">WITH_EXCEPT_START</span></code></a>. Then,
<a class="reference internal" href="../reference/datamodel.html#object.__enter__" title="object.__enter__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__enter__()</span></code></a> is called. Finally, the result of calling the
<code class="docutils literal notranslate"><span class="pre">__enter__()</span></code> method is pushed onto the stack.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-GET_LEN">
<span class="sig-name descname"><span class="pre">GET_LEN</span></span><a class="headerlink" href="#opcode-GET_LEN" title="Link to this definition"></a></dt>
<dd><p>Perform <code class="docutils literal notranslate"><span class="pre">STACK.append(len(STACK[-1]))</span></code>. Used in <a class="reference internal" href="../reference/compound_stmts.html#match"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">match</span></code></a> statements where
comparison with structure of pattern is needed.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.10.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-MATCH_MAPPING">
<span class="sig-name descname"><span class="pre">MATCH_MAPPING</span></span><a class="headerlink" href="#opcode-MATCH_MAPPING" title="Link to this definition"></a></dt>
<dd><p>If <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is an instance of <a class="reference internal" href="collections.abc.html#collections.abc.Mapping" title="collections.abc.Mapping"><code class="xref py py-class docutils literal notranslate"><span class="pre">collections.abc.Mapping</span></code></a> (or, more
technically: if it has the <a class="reference internal" href="../c-api/typeobj.html#c.Py_TPFLAGS_MAPPING" title="Py_TPFLAGS_MAPPING"><code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_TPFLAGS_MAPPING</span></code></a> flag set in its
<a class="reference internal" href="../c-api/typeobj.html#c.PyTypeObject.tp_flags" title="PyTypeObject.tp_flags"><code class="xref c c-member docutils literal notranslate"><span class="pre">tp_flags</span></code></a>), push <code class="docutils literal notranslate"><span class="pre">True</span></code> onto the stack. Otherwise,
push <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.10.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-MATCH_SEQUENCE">
<span class="sig-name descname"><span class="pre">MATCH_SEQUENCE</span></span><a class="headerlink" href="#opcode-MATCH_SEQUENCE" title="Link to this definition"></a></dt>
<dd><p>If <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is an instance of <a class="reference internal" href="collections.abc.html#collections.abc.Sequence" title="collections.abc.Sequence"><code class="xref py py-class docutils literal notranslate"><span class="pre">collections.abc.Sequence</span></code></a> and is <em>not</em> an instance
of <a class="reference internal" href="stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>/<a class="reference internal" href="stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a>/<a class="reference internal" href="stdtypes.html#bytearray" title="bytearray"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></a> (or, more technically: if it has
the <a class="reference internal" href="../c-api/typeobj.html#c.Py_TPFLAGS_SEQUENCE" title="Py_TPFLAGS_SEQUENCE"><code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_TPFLAGS_SEQUENCE</span></code></a> flag set in its <a class="reference internal" href="../c-api/typeobj.html#c.PyTypeObject.tp_flags" title="PyTypeObject.tp_flags"><code class="xref c c-member docutils literal notranslate"><span class="pre">tp_flags</span></code></a>),
push <code class="docutils literal notranslate"><span class="pre">True</span></code> onto the stack. Otherwise, push <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.10.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-MATCH_KEYS">
<span class="sig-name descname"><span class="pre">MATCH_KEYS</span></span><a class="headerlink" href="#opcode-MATCH_KEYS" title="Link to this definition"></a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is a tuple of mapping keys, and <code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code> is the match subject.
If <code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code> contains all of the keys in <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code>, push a <a class="reference internal" href="stdtypes.html#tuple" title="tuple"><code class="xref py py-class docutils literal notranslate"><span class="pre">tuple</span></code></a>
containing the corresponding values. Otherwise, push <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.10.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>Previously, this instruction also pushed a boolean value indicating
success (<code class="docutils literal notranslate"><span class="pre">True</span></code>) or failure (<code class="docutils literal notranslate"><span class="pre">False</span></code>).</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-STORE_NAME">
<span class="sig-name descname"><span class="pre">STORE_NAME</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">namei</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-STORE_NAME" title="Link to this definition"></a></dt>
<dd><p>Implements <code class="docutils literal notranslate"><span class="pre">name</span> <span class="pre">=</span> <span class="pre">STACK.pop()</span></code>. <em>namei</em> is the index of <em>name</em> in the attribute
<a class="reference internal" href="../reference/datamodel.html#codeobject.co_names" title="codeobject.co_names"><code class="xref py py-attr docutils literal notranslate"><span class="pre">co_names</span></code></a> of the <a class="reference internal" href="../reference/datamodel.html#code-objects"><span class="std std-ref">code object</span></a>.
The compiler tries to use <a class="reference internal" href="#opcode-STORE_FAST"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">STORE_FAST</span></code></a> or <a class="reference internal" href="#opcode-STORE_GLOBAL"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">STORE_GLOBAL</span></code></a> if possible.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-DELETE_NAME">
<span class="sig-name descname"><span class="pre">DELETE_NAME</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">namei</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-DELETE_NAME" title="Link to this definition"></a></dt>
<dd><p>Implements <code class="docutils literal notranslate"><span class="pre">del</span> <span class="pre">name</span></code>, where <em>namei</em> is the index into <a class="reference internal" href="../reference/datamodel.html#codeobject.co_names" title="codeobject.co_names"><code class="xref py py-attr docutils literal notranslate"><span class="pre">co_names</span></code></a>
attribute of the <a class="reference internal" href="../reference/datamodel.html#code-objects"><span class="std std-ref">code object</span></a>.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-UNPACK_SEQUENCE">
<span class="sig-name descname"><span class="pre">UNPACK_SEQUENCE</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">count</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-UNPACK_SEQUENCE" title="Link to this definition"></a></dt>
<dd><p>Unpacks <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> into <em>count</em> individual values, which are put onto the stack
right-to-left. Require there to be exactly <em>count</em> values.:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">assert</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">STACK</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span> <span class="o">==</span> <span class="n">count</span><span class="p">)</span>
<span class="n">STACK</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()[:</span><span class="o">-</span><span class="n">count</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>
</pre></div>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-UNPACK_EX">
<span class="sig-name descname"><span class="pre">UNPACK_EX</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">counts</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-UNPACK_EX" title="Link to this definition"></a></dt>
<dd><p>Implements assignment with a starred target: Unpacks an iterable in <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code>
into individual values, where the total number of values can be smaller than the
number of items in the iterable: one of the new values will be a list of all
leftover items.</p>
<p>The number of values before and after the list value is limited to 255.</p>
<p>The number of values before the list value is encoded in the argument of the
opcode. The number of values after the list if any is encoded using an
<code class="docutils literal notranslate"><span class="pre">EXTENDED_ARG</span></code>. As a consequence, the argument can be seen as a two bytes values
where the low byte of <em>counts</em> is the number of values before the list value, the
high byte of <em>counts</em> the number of values after it.</p>
<p>The extracted values are put onto the stack right-to-left, i.e. <code class="docutils literal notranslate"><span class="pre">a,</span> <span class="pre">*b,</span> <span class="pre">c</span> <span class="pre">=</span> <span class="pre">d</span></code>
will be stored after execution as <code class="docutils literal notranslate"><span class="pre">STACK.extend((a,</span> <span class="pre">b,</span> <span class="pre">c))</span></code>.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-STORE_ATTR">
<span class="sig-name descname"><span class="pre">STORE_ATTR</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">namei</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-STORE_ATTR" title="Link to this definition"></a></dt>
<dd><p>Implements:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">obj</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">value</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">obj</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">value</span>
</pre></div>
</div>
<p>where <em>namei</em> is the index of name in <a class="reference internal" href="../reference/datamodel.html#codeobject.co_names" title="codeobject.co_names"><code class="xref py py-attr docutils literal notranslate"><span class="pre">co_names</span></code></a> of the
<a class="reference internal" href="../reference/datamodel.html#code-objects"><span class="std std-ref">code object</span></a>.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-DELETE_ATTR">
<span class="sig-name descname"><span class="pre">DELETE_ATTR</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">namei</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-DELETE_ATTR" title="Link to this definition"></a></dt>
<dd><p>Implements:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">obj</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="k">del</span> <span class="n">obj</span><span class="o">.</span><span class="n">name</span>
</pre></div>
</div>
<p>where <em>namei</em> is the index of name into <a class="reference internal" href="../reference/datamodel.html#codeobject.co_names" title="codeobject.co_names"><code class="xref py py-attr docutils literal notranslate"><span class="pre">co_names</span></code></a> of the
<a class="reference internal" href="../reference/datamodel.html#code-objects"><span class="std std-ref">code object</span></a>.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-STORE_GLOBAL">
<span class="sig-name descname"><span class="pre">STORE_GLOBAL</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">namei</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-STORE_GLOBAL" title="Link to this definition"></a></dt>
<dd><p>Works as <a class="reference internal" href="#opcode-STORE_NAME"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">STORE_NAME</span></code></a>, but stores the name as a global.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-DELETE_GLOBAL">
<span class="sig-name descname"><span class="pre">DELETE_GLOBAL</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">namei</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-DELETE_GLOBAL" title="Link to this definition"></a></dt>
<dd><p>Works as <a class="reference internal" href="#opcode-DELETE_NAME"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">DELETE_NAME</span></code></a>, but deletes a global name.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_CONST">
<span class="sig-name descname"><span class="pre">LOAD_CONST</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">consti</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-LOAD_CONST" title="Link to this definition"></a></dt>
<dd><p>Pushes <code class="docutils literal notranslate"><span class="pre">co_consts[consti]</span></code> onto the stack.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_NAME">
<span class="sig-name descname"><span class="pre">LOAD_NAME</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">namei</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-LOAD_NAME" title="Link to this definition"></a></dt>
<dd><p>Pushes the value associated with <code class="docutils literal notranslate"><span class="pre">co_names[namei]</span></code> onto the stack.
The name is looked up within the locals, then the globals, then the builtins.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_LOCALS">
<span class="sig-name descname"><span class="pre">LOAD_LOCALS</span></span><a class="headerlink" href="#opcode-LOAD_LOCALS" title="Link to this definition"></a></dt>
<dd><p>Pushes a reference to the locals dictionary onto the stack. This is used
to prepare namespace dictionaries for <a class="reference internal" href="#opcode-LOAD_FROM_DICT_OR_DEREF"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_FROM_DICT_OR_DEREF</span></code></a>
and <a class="reference internal" href="#opcode-LOAD_FROM_DICT_OR_GLOBALS"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_FROM_DICT_OR_GLOBALS</span></code></a>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_FROM_DICT_OR_GLOBALS">
<span class="sig-name descname"><span class="pre">LOAD_FROM_DICT_OR_GLOBALS</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-LOAD_FROM_DICT_OR_GLOBALS" title="Link to this definition"></a></dt>
<dd><p>Pops a mapping off the stack and looks up the value for <code class="docutils literal notranslate"><span class="pre">co_names[namei]</span></code>.
If the name is not found there, looks it up in the globals and then the builtins,
similar to <a class="reference internal" href="#opcode-LOAD_GLOBAL"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_GLOBAL</span></code></a>.
This is used for loading global variables in
<a class="reference internal" href="../reference/executionmodel.html#annotation-scopes"><span class="std std-ref">annotation scopes</span></a> within class bodies.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-BUILD_TUPLE">
<span class="sig-name descname"><span class="pre">BUILD_TUPLE</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">count</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-BUILD_TUPLE" title="Link to this definition"></a></dt>
<dd><p>Creates a tuple consuming <em>count</em> items from the stack, and pushes the
resulting tuple onto the stack:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="n">count</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">value</span> <span class="o">=</span> <span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">value</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">STACK</span><span class="p">[</span><span class="o">-</span><span class="n">count</span><span class="p">:])</span>
<span class="n">STACK</span> <span class="o">=</span> <span class="n">STACK</span><span class="p">[:</span><span class="o">-</span><span class="n">count</span><span class="p">]</span>
<span class="n">STACK</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-BUILD_LIST">
<span class="sig-name descname"><span class="pre">BUILD_LIST</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">count</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-BUILD_LIST" title="Link to this definition"></a></dt>
<dd><p>Works as <a class="reference internal" href="#opcode-BUILD_TUPLE"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">BUILD_TUPLE</span></code></a>, but creates a list.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-BUILD_SET">
<span class="sig-name descname"><span class="pre">BUILD_SET</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">count</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-BUILD_SET" title="Link to this definition"></a></dt>
<dd><p>Works as <a class="reference internal" href="#opcode-BUILD_TUPLE"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">BUILD_TUPLE</span></code></a>, but creates a set.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-BUILD_MAP">
<span class="sig-name descname"><span class="pre">BUILD_MAP</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">count</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-BUILD_MAP" title="Link to this definition"></a></dt>
<dd><p>Pushes a new dictionary object onto the stack. Pops <code class="docutils literal notranslate"><span class="pre">2</span> <span class="pre">*</span> <span class="pre">count</span></code> items
so that the dictionary holds <em>count</em> entries:
<code class="docutils literal notranslate"><span class="pre">{...,</span> <span class="pre">STACK[-4]:</span> <span class="pre">STACK[-3],</span> <span class="pre">STACK[-2]:</span> <span class="pre">STACK[-1]}</span></code>.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.5: </span>The dictionary is created from stack items instead of creating an
empty dictionary pre-sized to hold <em>count</em> items.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-BUILD_CONST_KEY_MAP">
<span class="sig-name descname"><span class="pre">BUILD_CONST_KEY_MAP</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">count</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-BUILD_CONST_KEY_MAP" title="Link to this definition"></a></dt>
<dd><p>The version of <a class="reference internal" href="#opcode-BUILD_MAP"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">BUILD_MAP</span></code></a> specialized for constant keys. Pops the
top element on the stack which contains a tuple of keys, then starting from
<code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code>, pops <em>count</em> values to form values in the built dictionary.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.6.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-BUILD_STRING">
<span class="sig-name descname"><span class="pre">BUILD_STRING</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">count</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-BUILD_STRING" title="Link to this definition"></a></dt>
<dd><p>Concatenates <em>count</em> strings from the stack and pushes the resulting string
onto the stack.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.6.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LIST_EXTEND">
<span class="sig-name descname"><span class="pre">LIST_EXTEND</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-LIST_EXTEND" title="Link to this definition"></a></dt>
<dd><p>Implements:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">seq</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="nb">list</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">STACK</span><span class="p">[</span><span class="o">-</span><span class="n">i</span><span class="p">],</span> <span class="n">seq</span><span class="p">)</span>
</pre></div>
</div>
<p>Used to build lists.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-SET_UPDATE">
<span class="sig-name descname"><span class="pre">SET_UPDATE</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-SET_UPDATE" title="Link to this definition"></a></dt>
<dd><p>Implements:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">seq</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="nb">set</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">STACK</span><span class="p">[</span><span class="o">-</span><span class="n">i</span><span class="p">],</span> <span class="n">seq</span><span class="p">)</span>
</pre></div>
</div>
<p>Used to build sets.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-DICT_UPDATE">
<span class="sig-name descname"><span class="pre">DICT_UPDATE</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-DICT_UPDATE" title="Link to this definition"></a></dt>
<dd><p>Implements:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="nb">map</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="nb">dict</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">STACK</span><span class="p">[</span><span class="o">-</span><span class="n">i</span><span class="p">],</span> <span class="nb">map</span><span class="p">)</span>
</pre></div>
</div>
<p>Used to build dicts.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-DICT_MERGE">
<span class="sig-name descname"><span class="pre">DICT_MERGE</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-DICT_MERGE" title="Link to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#opcode-DICT_UPDATE"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">DICT_UPDATE</span></code></a> but raises an exception for duplicate keys.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_ATTR">
<span class="sig-name descname"><span class="pre">LOAD_ATTR</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">namei</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-LOAD_ATTR" title="Link to this definition"></a></dt>
<dd><p>If the low bit of <code class="docutils literal notranslate"><span class="pre">namei</span></code> is not set, this replaces <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> with
<code class="docutils literal notranslate"><span class="pre">getattr(STACK[-1],</span> <span class="pre">co_names[namei&gt;&gt;1])</span></code>.</p>
<p>If the low bit of <code class="docutils literal notranslate"><span class="pre">namei</span></code> is set, this will attempt to load a method named
<code class="docutils literal notranslate"><span class="pre">co_names[namei&gt;&gt;1]</span></code> from the <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> object. <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is popped.
This bytecode distinguishes two cases: if <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> has a method with the
correct name, the bytecode pushes the unbound method and <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code>.
<code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> will be used as the first argument (<code class="docutils literal notranslate"><span class="pre">self</span></code>) by <a class="reference internal" href="#opcode-CALL"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">CALL</span></code></a>
or <a class="reference internal" href="#opcode-CALL_KW"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">CALL_KW</span></code></a> when calling the unbound method.
Otherwise, <code class="docutils literal notranslate"><span class="pre">NULL</span></code> and the object returned by
the attribute lookup are pushed.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.12: </span>If the low bit of <code class="docutils literal notranslate"><span class="pre">namei</span></code> is set, then a <code class="docutils literal notranslate"><span class="pre">NULL</span></code> or <code class="docutils literal notranslate"><span class="pre">self</span></code> is
pushed to the stack before the attribute or unbound method respectively.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_SUPER_ATTR">
<span class="sig-name descname"><span class="pre">LOAD_SUPER_ATTR</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">namei</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-LOAD_SUPER_ATTR" title="Link to this definition"></a></dt>
<dd><p>This opcode implements <a class="reference internal" href="functions.html#super" title="super"><code class="xref py py-func docutils literal notranslate"><span class="pre">super()</span></code></a>, both in its zero-argument and
two-argument forms (e.g. <code class="docutils literal notranslate"><span class="pre">super().method()</span></code>, <code class="docutils literal notranslate"><span class="pre">super().attr</span></code> and
<code class="docutils literal notranslate"><span class="pre">super(cls,</span> <span class="pre">self).method()</span></code>, <code class="docutils literal notranslate"><span class="pre">super(cls,</span> <span class="pre">self).attr</span></code>).</p>
<p>It pops three values from the stack (from top of stack down):</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">self</span></code>: the first argument to the current method</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">cls</span></code>: the class within which the current method was defined</p></li>
<li><p>the global <code class="docutils literal notranslate"><span class="pre">super</span></code></p></li>
</ul>
<p>With respect to its argument, it works similarly to <a class="reference internal" href="#opcode-LOAD_ATTR"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_ATTR</span></code></a>,
except that <code class="docutils literal notranslate"><span class="pre">namei</span></code> is shifted left by 2 bits instead of 1.</p>
<p>The low bit of <code class="docutils literal notranslate"><span class="pre">namei</span></code> signals to attempt a method load, as with
<a class="reference internal" href="#opcode-LOAD_ATTR"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_ATTR</span></code></a>, which results in pushing <code class="docutils literal notranslate"><span class="pre">NULL</span></code> and the loaded method.
When it is unset a single value is pushed to the stack.</p>
<p>The second-low bit of <code class="docutils literal notranslate"><span class="pre">namei</span></code>, if set, means that this was a two-argument
call to <a class="reference internal" href="functions.html#super" title="super"><code class="xref py py-func docutils literal notranslate"><span class="pre">super()</span></code></a> (unset means zero-argument).</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-COMPARE_OP">
<span class="sig-name descname"><span class="pre">COMPARE_OP</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">opname</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-COMPARE_OP" title="Link to this definition"></a></dt>
<dd><p>Performs a Boolean operation. The operation name can be found in
<code class="docutils literal notranslate"><span class="pre">cmp_op[opname</span> <span class="pre">&gt;&gt;</span> <span class="pre">5]</span></code>. If the fifth-lowest bit of <code class="docutils literal notranslate"><span class="pre">opname</span></code> is set
(<code class="docutils literal notranslate"><span class="pre">opname</span> <span class="pre">&amp;</span> <span class="pre">16</span></code>), the result should be coerced to <code class="docutils literal notranslate"><span class="pre">bool</span></code>.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>The fifth-lowest bit of the oparg now indicates a forced conversion to
<a class="reference internal" href="functions.html#bool" title="bool"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-IS_OP">
<span class="sig-name descname"><span class="pre">IS_OP</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">invert</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-IS_OP" title="Link to this definition"></a></dt>
<dd><p>Performs <code class="docutils literal notranslate"><span class="pre">is</span></code> comparison, or <code class="docutils literal notranslate"><span class="pre">is</span> <span class="pre">not</span></code> if <code class="docutils literal notranslate"><span class="pre">invert</span></code> is 1.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-CONTAINS_OP">
<span class="sig-name descname"><span class="pre">CONTAINS_OP</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">invert</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-CONTAINS_OP" title="Link to this definition"></a></dt>
<dd><p>Performs <code class="docutils literal notranslate"><span class="pre">in</span></code> comparison, or <code class="docutils literal notranslate"><span class="pre">not</span> <span class="pre">in</span></code> if <code class="docutils literal notranslate"><span class="pre">invert</span></code> is 1.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-IMPORT_NAME">
<span class="sig-name descname"><span class="pre">IMPORT_NAME</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">namei</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-IMPORT_NAME" title="Link to this definition"></a></dt>
<dd><p>Imports the module <code class="docutils literal notranslate"><span class="pre">co_names[namei]</span></code>. <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> and <code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code> are
popped and provide the <em>fromlist</em> and <em>level</em> arguments of <a class="reference internal" href="functions.html#import__" title="__import__"><code class="xref py py-func docutils literal notranslate"><span class="pre">__import__()</span></code></a>.
The module object is pushed onto the stack. The current namespace is not affected: for a proper import statement, a subsequent <a class="reference internal" href="#opcode-STORE_FAST"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">STORE_FAST</span></code></a> instruction
modifies the namespace.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-IMPORT_FROM">
<span class="sig-name descname"><span class="pre">IMPORT_FROM</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">namei</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-IMPORT_FROM" title="Link to this definition"></a></dt>
<dd><p>Loads the attribute <code class="docutils literal notranslate"><span class="pre">co_names[namei]</span></code> from the module found in <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code>.
The resulting object is pushed onto the stack, to be subsequently stored by a
<a class="reference internal" href="#opcode-STORE_FAST"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">STORE_FAST</span></code></a> instruction.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-JUMP_FORWARD">
<span class="sig-name descname"><span class="pre">JUMP_FORWARD</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">delta</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-JUMP_FORWARD" title="Link to this definition"></a></dt>
<dd><p>Increments bytecode counter by <em>delta</em>.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-JUMP_BACKWARD">
<span class="sig-name descname"><span class="pre">JUMP_BACKWARD</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">delta</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-JUMP_BACKWARD" title="Link to this definition"></a></dt>
<dd><p>Decrements bytecode counter by <em>delta</em>. Checks for interrupts.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-JUMP_BACKWARD_NO_INTERRUPT">
<span class="sig-name descname"><span class="pre">JUMP_BACKWARD_NO_INTERRUPT</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">delta</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-JUMP_BACKWARD_NO_INTERRUPT" title="Link to this definition"></a></dt>
<dd><p>Decrements bytecode counter by <em>delta</em>. Does not check for interrupts.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-POP_JUMP_IF_TRUE">
<span class="sig-name descname"><span class="pre">POP_JUMP_IF_TRUE</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">delta</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-POP_JUMP_IF_TRUE" title="Link to this definition"></a></dt>
<dd><p>If <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is true, increments the bytecode counter by <em>delta</em>.
<code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is popped.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>The oparg is now a relative delta rather than an absolute target.
This opcode is a pseudo-instruction, replaced in final bytecode by
the directed versions (forward/backward).</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.12: </span>This is no longer a pseudo-instruction.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>This instruction now requires an exact <a class="reference internal" href="functions.html#bool" title="bool"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a> operand.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-POP_JUMP_IF_FALSE">
<span class="sig-name descname"><span class="pre">POP_JUMP_IF_FALSE</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">delta</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-POP_JUMP_IF_FALSE" title="Link to this definition"></a></dt>
<dd><p>If <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is false, increments the bytecode counter by <em>delta</em>.
<code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is popped.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>The oparg is now a relative delta rather than an absolute target.
This opcode is a pseudo-instruction, replaced in final bytecode by
the directed versions (forward/backward).</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.12: </span>This is no longer a pseudo-instruction.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>This instruction now requires an exact <a class="reference internal" href="functions.html#bool" title="bool"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a> operand.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-POP_JUMP_IF_NOT_NONE">
<span class="sig-name descname"><span class="pre">POP_JUMP_IF_NOT_NONE</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">delta</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-POP_JUMP_IF_NOT_NONE" title="Link to this definition"></a></dt>
<dd><p>If <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is not <code class="docutils literal notranslate"><span class="pre">None</span></code>, increments the bytecode counter by <em>delta</em>.
<code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is popped.</p>
<p>This opcode is a pseudo-instruction, replaced in final bytecode by
the directed versions (forward/backward).</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.12: </span>This is no longer a pseudo-instruction.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-POP_JUMP_IF_NONE">
<span class="sig-name descname"><span class="pre">POP_JUMP_IF_NONE</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">delta</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-POP_JUMP_IF_NONE" title="Link to this definition"></a></dt>
<dd><p>If <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is <code class="docutils literal notranslate"><span class="pre">None</span></code>, increments the bytecode counter by <em>delta</em>.
<code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is popped.</p>
<p>This opcode is a pseudo-instruction, replaced in final bytecode by
the directed versions (forward/backward).</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.12: </span>This is no longer a pseudo-instruction.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-FOR_ITER">
<span class="sig-name descname"><span class="pre">FOR_ITER</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">delta</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-FOR_ITER" title="Link to this definition"></a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is an <a class="reference internal" href="../glossary.html#term-iterator"><span class="xref std std-term">iterator</span></a>. Call its <a class="reference internal" href="stdtypes.html#iterator.__next__" title="iterator.__next__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__next__()</span></code></a> method.
If this yields a new value, push it on the stack (leaving the iterator below
it). If the iterator indicates it is exhausted then the byte code counter is
incremented by <em>delta</em>.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.12: </span>Up until 3.11 the iterator was popped when it was exhausted.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_GLOBAL">
<span class="sig-name descname"><span class="pre">LOAD_GLOBAL</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">namei</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-LOAD_GLOBAL" title="Link to this definition"></a></dt>
<dd><p>Loads the global named <code class="docutils literal notranslate"><span class="pre">co_names[namei&gt;&gt;1]</span></code> onto the stack.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>If the low bit of <code class="docutils literal notranslate"><span class="pre">namei</span></code> is set, then a <code class="docutils literal notranslate"><span class="pre">NULL</span></code> is pushed to the
stack before the global variable.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_FAST">
<span class="sig-name descname"><span class="pre">LOAD_FAST</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">var_num</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-LOAD_FAST" title="Link to this definition"></a></dt>
<dd><p>Pushes a reference to the local <code class="docutils literal notranslate"><span class="pre">co_varnames[var_num]</span></code> onto the stack.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.12: </span>This opcode is now only used in situations where the local variable is
guaranteed to be initialized. It cannot raise <a class="reference internal" href="exceptions.html#UnboundLocalError" title="UnboundLocalError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UnboundLocalError</span></code></a>.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_FAST_LOAD_FAST">
<span class="sig-name descname"><span class="pre">LOAD_FAST_LOAD_FAST</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">var_nums</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-LOAD_FAST_LOAD_FAST" title="Link to this definition"></a></dt>
<dd><p>Pushes references to <code class="docutils literal notranslate"><span class="pre">co_varnames[var_nums</span> <span class="pre">&gt;&gt;</span> <span class="pre">4]</span></code> and
<code class="docutils literal notranslate"><span class="pre">co_varnames[var_nums</span> <span class="pre">&amp;</span> <span class="pre">15]</span></code> onto the stack.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_FAST_CHECK">
<span class="sig-name descname"><span class="pre">LOAD_FAST_CHECK</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">var_num</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-LOAD_FAST_CHECK" title="Link to this definition"></a></dt>
<dd><p>Pushes a reference to the local <code class="docutils literal notranslate"><span class="pre">co_varnames[var_num]</span></code> onto the stack,
raising an <a class="reference internal" href="exceptions.html#UnboundLocalError" title="UnboundLocalError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UnboundLocalError</span></code></a> if the local variable has not been
initialized.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_FAST_AND_CLEAR">
<span class="sig-name descname"><span class="pre">LOAD_FAST_AND_CLEAR</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">var_num</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-LOAD_FAST_AND_CLEAR" title="Link to this definition"></a></dt>
<dd><p>Pushes a reference to the local <code class="docutils literal notranslate"><span class="pre">co_varnames[var_num]</span></code> onto the stack (or
pushes <code class="docutils literal notranslate"><span class="pre">NULL</span></code> onto the stack if the local variable has not been
initialized) and sets <code class="docutils literal notranslate"><span class="pre">co_varnames[var_num]</span></code> to <code class="docutils literal notranslate"><span class="pre">NULL</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-STORE_FAST">
<span class="sig-name descname"><span class="pre">STORE_FAST</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">var_num</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-STORE_FAST" title="Link to this definition"></a></dt>
<dd><p>Stores <code class="docutils literal notranslate"><span class="pre">STACK.pop()</span></code> into the local <code class="docutils literal notranslate"><span class="pre">co_varnames[var_num]</span></code>.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-STORE_FAST_STORE_FAST">
<span class="sig-name descname"><span class="pre">STORE_FAST_STORE_FAST</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">var_nums</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-STORE_FAST_STORE_FAST" title="Link to this definition"></a></dt>
<dd><p>Stores <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> into <code class="docutils literal notranslate"><span class="pre">co_varnames[var_nums</span> <span class="pre">&gt;&gt;</span> <span class="pre">4]</span></code>
and <code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code> into <code class="docutils literal notranslate"><span class="pre">co_varnames[var_nums</span> <span class="pre">&amp;</span> <span class="pre">15]</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-STORE_FAST_LOAD_FAST">
<span class="sig-name descname"><span class="pre">STORE_FAST_LOAD_FAST</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">var_nums</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-STORE_FAST_LOAD_FAST" title="Link to this definition"></a></dt>
<dd><p>Stores <code class="docutils literal notranslate"><span class="pre">STACK.pop()</span></code> into the local <code class="docutils literal notranslate"><span class="pre">co_varnames[var_nums</span> <span class="pre">&gt;&gt;</span> <span class="pre">4]</span></code>
and pushes a reference to the local <code class="docutils literal notranslate"><span class="pre">co_varnames[var_nums</span> <span class="pre">&amp;</span> <span class="pre">15]</span></code>
onto the stack.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-DELETE_FAST">
<span class="sig-name descname"><span class="pre">DELETE_FAST</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">var_num</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-DELETE_FAST" title="Link to this definition"></a></dt>
<dd><p>Deletes local <code class="docutils literal notranslate"><span class="pre">co_varnames[var_num]</span></code>.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-MAKE_CELL">
<span class="sig-name descname"><span class="pre">MAKE_CELL</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-MAKE_CELL" title="Link to this definition"></a></dt>
<dd><p>Creates a new cell in slot <code class="docutils literal notranslate"><span class="pre">i</span></code>. If that slot is nonempty then
that value is stored into the new cell.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_DEREF">
<span class="sig-name descname"><span class="pre">LOAD_DEREF</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-LOAD_DEREF" title="Link to this definition"></a></dt>
<dd><p>Loads the cell contained in slot <code class="docutils literal notranslate"><span class="pre">i</span></code> of the “fast locals” storage.
Pushes a reference to the object the cell contains on the stack.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span><code class="docutils literal notranslate"><span class="pre">i</span></code> is no longer offset by the length of <a class="reference internal" href="../reference/datamodel.html#codeobject.co_varnames" title="codeobject.co_varnames"><code class="xref py py-attr docutils literal notranslate"><span class="pre">co_varnames</span></code></a>.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_FROM_DICT_OR_DEREF">
<span class="sig-name descname"><span class="pre">LOAD_FROM_DICT_OR_DEREF</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-LOAD_FROM_DICT_OR_DEREF" title="Link to this definition"></a></dt>
<dd><p>Pops a mapping off the stack and looks up the name associated with
slot <code class="docutils literal notranslate"><span class="pre">i</span></code> of the “fast locals” storage in this mapping.
If the name is not found there, loads it from the cell contained in
slot <code class="docutils literal notranslate"><span class="pre">i</span></code>, similar to <a class="reference internal" href="#opcode-LOAD_DEREF"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_DEREF</span></code></a>. This is used for loading
<a class="reference internal" href="../glossary.html#term-closure-variable"><span class="xref std std-term">closure variables</span></a> in class bodies (which previously used
<code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_CLASSDEREF</span></code>) and in
<a class="reference internal" href="../reference/executionmodel.html#annotation-scopes"><span class="std std-ref">annotation scopes</span></a> within class bodies.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-STORE_DEREF">
<span class="sig-name descname"><span class="pre">STORE_DEREF</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-STORE_DEREF" title="Link to this definition"></a></dt>
<dd><p>Stores <code class="docutils literal notranslate"><span class="pre">STACK.pop()</span></code> into the cell contained in slot <code class="docutils literal notranslate"><span class="pre">i</span></code> of the “fast locals”
storage.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span><code class="docutils literal notranslate"><span class="pre">i</span></code> is no longer offset by the length of <a class="reference internal" href="../reference/datamodel.html#codeobject.co_varnames" title="codeobject.co_varnames"><code class="xref py py-attr docutils literal notranslate"><span class="pre">co_varnames</span></code></a>.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-DELETE_DEREF">
<span class="sig-name descname"><span class="pre">DELETE_DEREF</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-DELETE_DEREF" title="Link to this definition"></a></dt>
<dd><p>Empties the cell contained in slot <code class="docutils literal notranslate"><span class="pre">i</span></code> of the “fast locals” storage.
Used by the <a class="reference internal" href="../reference/simple_stmts.html#del"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">del</span></code></a> statement.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.2.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span><code class="docutils literal notranslate"><span class="pre">i</span></code> is no longer offset by the length of <a class="reference internal" href="../reference/datamodel.html#codeobject.co_varnames" title="codeobject.co_varnames"><code class="xref py py-attr docutils literal notranslate"><span class="pre">co_varnames</span></code></a>.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-COPY_FREE_VARS">
<span class="sig-name descname"><span class="pre">COPY_FREE_VARS</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">n</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-COPY_FREE_VARS" title="Link to this definition"></a></dt>
<dd><p>Copies the <code class="docutils literal notranslate"><span class="pre">n</span></code> <a class="reference internal" href="../glossary.html#term-closure-variable"><span class="xref std std-term">free (closure) variables</span></a> from the closure
into the frame. Removes the need for special code on the callers side when calling
closures.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-RAISE_VARARGS">
<span class="sig-name descname"><span class="pre">RAISE_VARARGS</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">argc</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-RAISE_VARARGS" title="Link to this definition"></a></dt>
<dd><p>Raises an exception using one of the 3 forms of the <code class="docutils literal notranslate"><span class="pre">raise</span></code> statement,
depending on the value of <em>argc</em>:</p>
<ul class="simple">
<li><p>0: <code class="docutils literal notranslate"><span class="pre">raise</span></code> (re-raise previous exception)</p></li>
<li><p>1: <code class="docutils literal notranslate"><span class="pre">raise</span> <span class="pre">STACK[-1]</span></code> (raise exception instance or type at <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code>)</p></li>
<li><p>2: <code class="docutils literal notranslate"><span class="pre">raise</span> <span class="pre">STACK[-2]</span> <span class="pre">from</span> <span class="pre">STACK[-1]</span></code> (raise exception instance or type at
<code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code> with <code class="docutils literal notranslate"><span class="pre">__cause__</span></code> set to <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code>)</p></li>
</ul>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-CALL">
<span class="sig-name descname"><span class="pre">CALL</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">argc</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-CALL" title="Link to this definition"></a></dt>
<dd><p>Calls a callable object with the number of arguments specified by <code class="docutils literal notranslate"><span class="pre">argc</span></code>.
On the stack are (in ascending order):</p>
<ul class="simple">
<li><p>The callable</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">self</span></code> or <code class="docutils literal notranslate"><span class="pre">NULL</span></code></p></li>
<li><p>The remaining positional arguments</p></li>
</ul>
<p><code class="docutils literal notranslate"><span class="pre">argc</span></code> is the total of the positional arguments, excluding <code class="docutils literal notranslate"><span class="pre">self</span></code>.</p>
<p><code class="docutils literal notranslate"><span class="pre">CALL</span></code> pops all arguments and the callable object off the stack,
calls the callable object with those arguments, and pushes the return value
returned by the callable object.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>The callable now always appears at the same position on the stack.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>Calls with keyword arguments are now handled by <a class="reference internal" href="#opcode-CALL_KW"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">CALL_KW</span></code></a>.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-CALL_KW">
<span class="sig-name descname"><span class="pre">CALL_KW</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">argc</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-CALL_KW" title="Link to this definition"></a></dt>
<dd><p>Calls a callable object with the number of arguments specified by <code class="docutils literal notranslate"><span class="pre">argc</span></code>,
including one or more named arguments. On the stack are (in ascending order):</p>
<ul class="simple">
<li><p>The callable</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">self</span></code> or <code class="docutils literal notranslate"><span class="pre">NULL</span></code></p></li>
<li><p>The remaining positional arguments</p></li>
<li><p>The named arguments</p></li>
<li><p>A <a class="reference internal" href="stdtypes.html#tuple" title="tuple"><code class="xref py py-class docutils literal notranslate"><span class="pre">tuple</span></code></a> of keyword argument names</p></li>
</ul>
<p><code class="docutils literal notranslate"><span class="pre">argc</span></code> is the total of the positional and named arguments, excluding <code class="docutils literal notranslate"><span class="pre">self</span></code>.
The length of the tuple of keyword argument names is the number of named arguments.</p>
<p><code class="docutils literal notranslate"><span class="pre">CALL_KW</span></code> pops all arguments, the keyword names, and the callable object
off the stack, calls the callable object with those arguments, and pushes the
return value returned by the callable object.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-CALL_FUNCTION_EX">
<span class="sig-name descname"><span class="pre">CALL_FUNCTION_EX</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">flags</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-CALL_FUNCTION_EX" title="Link to this definition"></a></dt>
<dd><p>Calls a callable object with variable set of positional and keyword
arguments. If the lowest bit of <em>flags</em> is set, the top of the stack
contains a mapping object containing additional keyword arguments.
Before the callable is called, the mapping object and iterable object
are each “unpacked” and their contents passed in as keyword and
positional arguments respectively.
<code class="docutils literal notranslate"><span class="pre">CALL_FUNCTION_EX</span></code> pops all arguments and the callable object off the stack,
calls the callable object with those arguments, and pushes the return value
returned by the callable object.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.6.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-PUSH_NULL">
<span class="sig-name descname"><span class="pre">PUSH_NULL</span></span><a class="headerlink" href="#opcode-PUSH_NULL" title="Link to this definition"></a></dt>
<dd><p>Pushes a <code class="docutils literal notranslate"><span class="pre">NULL</span></code> to the stack.
Used in the call sequence to match the <code class="docutils literal notranslate"><span class="pre">NULL</span></code> pushed by
<a class="reference internal" href="#opcode-LOAD_METHOD"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">LOAD_METHOD</span></code></a> for non-method calls.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-MAKE_FUNCTION">
<span class="sig-name descname"><span class="pre">MAKE_FUNCTION</span></span><a class="headerlink" href="#opcode-MAKE_FUNCTION" title="Link to this definition"></a></dt>
<dd><p>Pushes a new function object on the stack built from the code object at <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code>.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.10: </span>Flag value <code class="docutils literal notranslate"><span class="pre">0x04</span></code> is a tuple of strings instead of dictionary</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>Qualified name at <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> was removed.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>Extra function attributes on the stack, signaled by oparg flags, were
removed. They now use <a class="reference internal" href="#opcode-SET_FUNCTION_ATTRIBUTE"><code class="xref std std-opcode docutils literal notranslate"><span class="pre">SET_FUNCTION_ATTRIBUTE</span></code></a>.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-SET_FUNCTION_ATTRIBUTE">
<span class="sig-name descname"><span class="pre">SET_FUNCTION_ATTRIBUTE</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">flag</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-SET_FUNCTION_ATTRIBUTE" title="Link to this definition"></a></dt>
<dd><p>Sets an attribute on a function object. Expects the function at <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code>
and the attribute value to set at <code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code>; consumes both and leaves the
function at <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code>. The flag determines which attribute to set:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">0x01</span></code> a tuple of default values for positional-only and
positional-or-keyword parameters in positional order</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">0x02</span></code> a dictionary of keyword-only parameters default values</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">0x04</span></code> a tuple of strings containing parameters annotations</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">0x08</span></code> a tuple containing cells for free variables, making a closure</p></li>
</ul>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-BUILD_SLICE">
<span class="sig-name descname"><span class="pre">BUILD_SLICE</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">argc</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-BUILD_SLICE" title="Link to this definition"></a></dt>
<dd><p id="index-1">Pushes a slice object on the stack. <em>argc</em> must be 2 or 3. If it is 2, implements:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">end</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">start</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">STACK</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">slice</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">))</span>
</pre></div>
</div>
<p>if it is 3, implements:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">step</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">end</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">start</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">STACK</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">slice</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">,</span> <span class="n">step</span><span class="p">))</span>
</pre></div>
</div>
<p>See the <a class="reference internal" href="functions.html#slice" title="slice"><code class="xref py py-func docutils literal notranslate"><span class="pre">slice()</span></code></a> built-in function for more information.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-EXTENDED_ARG">
<span class="sig-name descname"><span class="pre">EXTENDED_ARG</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">ext</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-EXTENDED_ARG" title="Link to this definition"></a></dt>
<dd><p>Prefixes any opcode which has an argument too big to fit into the default one
byte. <em>ext</em> holds an additional byte which act as higher bits in the argument.
For each opcode, at most three prefixal <code class="docutils literal notranslate"><span class="pre">EXTENDED_ARG</span></code> are allowed, forming
an argument from two-byte to four-byte.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-CONVERT_VALUE">
<span class="sig-name descname"><span class="pre">CONVERT_VALUE</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">oparg</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-CONVERT_VALUE" title="Link to this definition"></a></dt>
<dd><p>Convert value to a string, depending on <code class="docutils literal notranslate"><span class="pre">oparg</span></code>:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">value</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">func</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
<span class="n">STACK</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">result</span><span class="p">)</span>
</pre></div>
</div>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">oparg</span> <span class="pre">==</span> <span class="pre">1</span></code>: call <a class="reference internal" href="stdtypes.html#str" title="str"><code class="xref py py-func docutils literal notranslate"><span class="pre">str()</span></code></a> on <em>value</em></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">oparg</span> <span class="pre">==</span> <span class="pre">2</span></code>: call <a class="reference internal" href="functions.html#repr" title="repr"><code class="xref py py-func docutils literal notranslate"><span class="pre">repr()</span></code></a> on <em>value</em></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">oparg</span> <span class="pre">==</span> <span class="pre">3</span></code>: call <a class="reference internal" href="functions.html#ascii" title="ascii"><code class="xref py py-func docutils literal notranslate"><span class="pre">ascii()</span></code></a> on <em>value</em></p></li>
</ul>
<p>Used for implementing formatted literal strings (f-strings).</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-FORMAT_SIMPLE">
<span class="sig-name descname"><span class="pre">FORMAT_SIMPLE</span></span><a class="headerlink" href="#opcode-FORMAT_SIMPLE" title="Link to this definition"></a></dt>
<dd><p>Formats the value on top of stack:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">value</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="fm">__format__</span><span class="p">(</span><span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="n">STACK</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">result</span><span class="p">)</span>
</pre></div>
</div>
<p>Used for implementing formatted literal strings (f-strings).</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-FORMAT_WITH_SPEC">
<span class="sig-name descname"><span class="pre">FORMAT_WITH_SPEC</span></span><a class="headerlink" href="#opcode-FORMAT_WITH_SPEC" title="Link to this definition"></a></dt>
<dd><p>Formats the given value with the given format spec:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">spec</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">value</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="fm">__format__</span><span class="p">(</span><span class="n">spec</span><span class="p">)</span>
<span class="n">STACK</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">result</span><span class="p">)</span>
</pre></div>
</div>
<p>Used for implementing formatted literal strings (f-strings).</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-MATCH_CLASS">
<span class="sig-name descname"><span class="pre">MATCH_CLASS</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">count</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-MATCH_CLASS" title="Link to this definition"></a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> is a tuple of keyword attribute names, <code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code> is the class
being matched against, and <code class="docutils literal notranslate"><span class="pre">STACK[-3]</span></code> is the match subject. <em>count</em> is the
number of positional sub-patterns.</p>
<p>Pop <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code>, <code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code>, and <code class="docutils literal notranslate"><span class="pre">STACK[-3]</span></code>. If <code class="docutils literal notranslate"><span class="pre">STACK[-3]</span></code> is an
instance of <code class="docutils literal notranslate"><span class="pre">STACK[-2]</span></code> and has the positional and keyword attributes
required by <em>count</em> and <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code>, push a tuple of extracted attributes.
Otherwise, push <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.10.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.11: </span>Previously, this instruction also pushed a boolean value indicating
success (<code class="docutils literal notranslate"><span class="pre">True</span></code>) or failure (<code class="docutils literal notranslate"><span class="pre">False</span></code>).</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-RESUME">
<span class="sig-name descname"><span class="pre">RESUME</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">context</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-RESUME" title="Link to this definition"></a></dt>
<dd><p>A no-op. Performs internal tracing, debugging and optimization checks.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">context</span></code> oparand consists of two parts. The lowest two bits
indicate where the <code class="docutils literal notranslate"><span class="pre">RESUME</span></code> occurs:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">0</span></code> The start of a function, which is neither a generator, coroutine
nor an async generator</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">1</span></code> After a <code class="docutils literal notranslate"><span class="pre">yield</span></code> expression</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">2</span></code> After a <code class="docutils literal notranslate"><span class="pre">yield</span> <span class="pre">from</span></code> expression</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">3</span></code> After an <code class="docutils literal notranslate"><span class="pre">await</span></code> expression</p></li>
</ul>
<p>The next bit is <code class="docutils literal notranslate"><span class="pre">1</span></code> if the RESUME is at except-depth <code class="docutils literal notranslate"><span class="pre">1</span></code>, and <code class="docutils literal notranslate"><span class="pre">0</span></code>
otherwise.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>The oparg value changed to include information about except-depth</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-RETURN_GENERATOR">
<span class="sig-name descname"><span class="pre">RETURN_GENERATOR</span></span><a class="headerlink" href="#opcode-RETURN_GENERATOR" title="Link to this definition"></a></dt>
<dd><p>Create a generator, coroutine, or async generator from the current frame.
Used as first opcode of in code object for the above mentioned callables.
Clear the current frame and return the newly created generator.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-SEND">
<span class="sig-name descname"><span class="pre">SEND</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">delta</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-SEND" title="Link to this definition"></a></dt>
<dd><p>Equivalent to <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span> <span class="pre">=</span> <span class="pre">STACK[-2].send(STACK[-1])</span></code>. Used in <code class="docutils literal notranslate"><span class="pre">yield</span> <span class="pre">from</span></code>
and <code class="docutils literal notranslate"><span class="pre">await</span></code> statements.</p>
<p>If the call raises <a class="reference internal" href="exceptions.html#StopIteration" title="StopIteration"><code class="xref py py-exc docutils literal notranslate"><span class="pre">StopIteration</span></code></a>, pop the top value from the stack,
push the exceptions <code class="docutils literal notranslate"><span class="pre">value</span></code> attribute, and increment the bytecode counter
by <em>delta</em>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.11.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-HAVE_ARGUMENT">
<span class="sig-name descname"><span class="pre">HAVE_ARGUMENT</span></span><a class="headerlink" href="#opcode-HAVE_ARGUMENT" title="Link to this definition"></a></dt>
<dd><p>This is not really an opcode. It identifies the dividing line between
opcodes in the range [0,255] which dont use their argument and those
that do (<code class="docutils literal notranslate"><span class="pre">&lt;</span> <span class="pre">HAVE_ARGUMENT</span></code> and <code class="docutils literal notranslate"><span class="pre">&gt;=</span> <span class="pre">HAVE_ARGUMENT</span></code>, respectively).</p>
<p>If your application uses pseudo instructions or specialized instructions,
use the <a class="reference internal" href="#dis.hasarg" title="dis.hasarg"><code class="xref py py-data docutils literal notranslate"><span class="pre">hasarg</span></code></a> collection instead.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.6: </span>Now every instruction has an argument, but opcodes <code class="docutils literal notranslate"><span class="pre">&lt;</span> <span class="pre">HAVE_ARGUMENT</span></code>
ignore it. Before, only opcodes <code class="docutils literal notranslate"><span class="pre">&gt;=</span> <span class="pre">HAVE_ARGUMENT</span></code> had an argument.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.12: </span>Pseudo instructions were added to the <a class="reference internal" href="#module-dis" title="dis: Disassembler for Python bytecode."><code class="xref py py-mod docutils literal notranslate"><span class="pre">dis</span></code></a> module, and for them
it is not true that comparison with <code class="docutils literal notranslate"><span class="pre">HAVE_ARGUMENT</span></code> indicates whether
they use their arg.</p>
</div>
<div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 3.13: </span>Use <a class="reference internal" href="#dis.hasarg" title="dis.hasarg"><code class="xref py py-data docutils literal notranslate"><span class="pre">hasarg</span></code></a> instead.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-CALL_INTRINSIC_1">
<span class="sig-name descname"><span class="pre">CALL_INTRINSIC_1</span></span><a class="headerlink" href="#opcode-CALL_INTRINSIC_1" title="Link to this definition"></a></dt>
<dd><p>Calls an intrinsic function with one argument. Passes <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> as the
argument and sets <code class="docutils literal notranslate"><span class="pre">STACK[-1]</span></code> to the result. Used to implement
functionality that is not performance critical.</p>
<p>The operand determines which intrinsic function is called:</p>
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Operand</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_1_INVALID</span></code></p></td>
<td><p>Not valid</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_PRINT</span></code></p></td>
<td><p>Prints the argument to standard
out. Used in the REPL.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_IMPORT_STAR</span></code></p></td>
<td><p>Performs <code class="docutils literal notranslate"><span class="pre">import</span> <span class="pre">*</span></code> for the
named module.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_STOPITERATION_ERROR</span></code></p></td>
<td><p>Extracts the return value from a
<code class="docutils literal notranslate"><span class="pre">StopIteration</span></code> exception.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_ASYNC_GEN_WRAP</span></code></p></td>
<td><p>Wraps an async generator value</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_UNARY_POSITIVE</span></code></p></td>
<td><p>Performs the unary <code class="docutils literal notranslate"><span class="pre">+</span></code>
operation</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_LIST_TO_TUPLE</span></code></p></td>
<td><p>Converts a list to a tuple</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_TYPEVAR</span></code></p></td>
<td><p>Creates a <a class="reference internal" href="typing.html#typing.TypeVar" title="typing.TypeVar"><code class="xref py py-class docutils literal notranslate"><span class="pre">typing.TypeVar</span></code></a></p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_PARAMSPEC</span></code></p></td>
<td><p>Creates a
<a class="reference internal" href="typing.html#typing.ParamSpec" title="typing.ParamSpec"><code class="xref py py-class docutils literal notranslate"><span class="pre">typing.ParamSpec</span></code></a></p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_TYPEVARTUPLE</span></code></p></td>
<td><p>Creates a
<a class="reference internal" href="typing.html#typing.TypeVarTuple" title="typing.TypeVarTuple"><code class="xref py py-class docutils literal notranslate"><span class="pre">typing.TypeVarTuple</span></code></a></p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_SUBSCRIPT_GENERIC</span></code></p></td>
<td><p>Returns <a class="reference internal" href="typing.html#typing.Generic" title="typing.Generic"><code class="xref py py-class docutils literal notranslate"><span class="pre">typing.Generic</span></code></a>
subscripted with the argument</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_TYPEALIAS</span></code></p></td>
<td><p>Creates a
<a class="reference internal" href="typing.html#typing.TypeAliasType" title="typing.TypeAliasType"><code class="xref py py-class docutils literal notranslate"><span class="pre">typing.TypeAliasType</span></code></a>;
used in the <a class="reference internal" href="../reference/simple_stmts.html#type"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">type</span></code></a>
statement. The argument is a tuple
of the type aliass name,
type parameters, and value.</p></td>
</tr>
</tbody>
</table>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-CALL_INTRINSIC_2">
<span class="sig-name descname"><span class="pre">CALL_INTRINSIC_2</span></span><a class="headerlink" href="#opcode-CALL_INTRINSIC_2" title="Link to this definition"></a></dt>
<dd><p>Calls an intrinsic function with two arguments. Used to implement functionality
that is not performance critical:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">arg2</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">arg1</span> <span class="o">=</span> <span class="n">STACK</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">intrinsic2</span><span class="p">(</span><span class="n">arg1</span><span class="p">,</span> <span class="n">arg2</span><span class="p">)</span>
<span class="n">STACK</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">result</span><span class="p">)</span>
</pre></div>
</div>
<p>The operand determines which intrinsic function is called:</p>
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Operand</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_2_INVALID</span></code></p></td>
<td><p>Not valid</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_PREP_RERAISE_STAR</span></code></p></td>
<td><p>Calculates the
<a class="reference internal" href="exceptions.html#ExceptionGroup" title="ExceptionGroup"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ExceptionGroup</span></code></a> to raise
from a <code class="docutils literal notranslate"><span class="pre">try-except*</span></code>.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_TYPEVAR_WITH_BOUND</span></code></p></td>
<td><p>Creates a <a class="reference internal" href="typing.html#typing.TypeVar" title="typing.TypeVar"><code class="xref py py-class docutils literal notranslate"><span class="pre">typing.TypeVar</span></code></a>
with a bound.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_TYPEVAR_WITH_CONSTRAINTS</span></code></p></td>
<td><p>Creates a
<a class="reference internal" href="typing.html#typing.TypeVar" title="typing.TypeVar"><code class="xref py py-class docutils literal notranslate"><span class="pre">typing.TypeVar</span></code></a> with
constraints.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">INTRINSIC_SET_FUNCTION_TYPE_PARAMS</span></code></p></td>
<td><p>Sets the <code class="docutils literal notranslate"><span class="pre">__type_params__</span></code>
attribute of a function.</p></td>
</tr>
</tbody>
</table>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<p><strong>Pseudo-instructions</strong></p>
<p>These opcodes do not appear in Python bytecode. They are used by the compiler
but are replaced by real opcodes or removed before bytecode is generated.</p>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-SETUP_FINALLY">
<span class="sig-name descname"><span class="pre">SETUP_FINALLY</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">target</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-SETUP_FINALLY" title="Link to this definition"></a></dt>
<dd><p>Set up an exception handler for the following code block. If an exception
occurs, the value stack level is restored to its current state and control
is transferred to the exception handler at <code class="docutils literal notranslate"><span class="pre">target</span></code>.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-SETUP_CLEANUP">
<span class="sig-name descname"><span class="pre">SETUP_CLEANUP</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">target</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-SETUP_CLEANUP" title="Link to this definition"></a></dt>
<dd><p>Like <code class="docutils literal notranslate"><span class="pre">SETUP_FINALLY</span></code>, but in case of an exception also pushes the last
instruction (<code class="docutils literal notranslate"><span class="pre">lasti</span></code>) to the stack so that <code class="docutils literal notranslate"><span class="pre">RERAISE</span></code> can restore it.
If an exception occurs, the value stack level and the last instruction on
the frame are restored to their current state, and control is transferred
to the exception handler at <code class="docutils literal notranslate"><span class="pre">target</span></code>.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-SETUP_WITH">
<span class="sig-name descname"><span class="pre">SETUP_WITH</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">target</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-SETUP_WITH" title="Link to this definition"></a></dt>
<dd><p>Like <code class="docutils literal notranslate"><span class="pre">SETUP_CLEANUP</span></code>, but in case of an exception one more item is popped
from the stack before control is transferred to the exception handler at
<code class="docutils literal notranslate"><span class="pre">target</span></code>.</p>
<p>This variant is used in <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>
constructs, which push the return value of the context managers
<a class="reference internal" href="../reference/datamodel.html#object.__enter__" title="object.__enter__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__enter__()</span></code></a> or <a class="reference internal" href="../reference/datamodel.html#object.__aenter__" title="object.__aenter__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__aenter__()</span></code></a> to the stack.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-POP_BLOCK">
<span class="sig-name descname"><span class="pre">POP_BLOCK</span></span><a class="headerlink" href="#opcode-POP_BLOCK" title="Link to this definition"></a></dt>
<dd><p>Marks the end of the code block associated with the last <code class="docutils literal notranslate"><span class="pre">SETUP_FINALLY</span></code>,
<code class="docutils literal notranslate"><span class="pre">SETUP_CLEANUP</span></code> or <code class="docutils literal notranslate"><span class="pre">SETUP_WITH</span></code>.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-JUMP">
<span class="sig-name descname"><span class="pre">JUMP</span></span><a class="headerlink" href="#opcode-JUMP" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-JUMP_NO_INTERRUPT">
<span class="sig-name descname"><span class="pre">JUMP_NO_INTERRUPT</span></span><a class="headerlink" href="#opcode-JUMP_NO_INTERRUPT" title="Link to this definition"></a></dt>
<dd><p>Undirected relative jump instructions which are replaced by their
directed (forward/backward) counterparts by the assembler.</p>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_CLOSURE">
<span class="sig-name descname"><span class="pre">LOAD_CLOSURE</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">i</span></em><span class="sig-paren">)</span><a class="headerlink" href="#opcode-LOAD_CLOSURE" title="Link to this definition"></a></dt>
<dd><p>Pushes a reference to the cell contained in slot <code class="docutils literal notranslate"><span class="pre">i</span></code> of the “fast locals”
storage.</p>
<p>Note that <code class="docutils literal notranslate"><span class="pre">LOAD_CLOSURE</span></code> is replaced with <code class="docutils literal notranslate"><span class="pre">LOAD_FAST</span></code> in the assembler.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.13: </span>This opcode is now a pseudo-instruction.</p>
</div>
</dd></dl>
<dl class="std opcode">
<dt class="sig sig-object std" id="opcode-LOAD_METHOD">
<span class="sig-name descname"><span class="pre">LOAD_METHOD</span></span><a class="headerlink" href="#opcode-LOAD_METHOD" title="Link to this definition"></a></dt>
<dd><p>Optimized unbound method lookup. Emitted as a <code class="docutils literal notranslate"><span class="pre">LOAD_ATTR</span></code> opcode
with a flag set in the arg.</p>
</dd></dl>
</section>
<section id="opcode-collections">
<span id="id1"></span><h2>Opcode collections<a class="headerlink" href="#opcode-collections" title="Link to this heading"></a></h2>
<p>These collections are provided for automatic introspection of bytecode
instructions:</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.12: </span>The collections now contain pseudo instructions and instrumented
instructions as well. These are opcodes with values <code class="docutils literal notranslate"><span class="pre">&gt;=</span> <span class="pre">MIN_PSEUDO_OPCODE</span></code>
and <code class="docutils literal notranslate"><span class="pre">&gt;=</span> <span class="pre">MIN_INSTRUMENTED_OPCODE</span></code>.</p>
</div>
<dl class="py data">
<dt class="sig sig-object py" id="dis.opname">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">opname</span></span><a class="headerlink" href="#dis.opname" title="Link to this definition"></a></dt>
<dd><p>Sequence of operation names, indexable using the bytecode.</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.opmap">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">opmap</span></span><a class="headerlink" href="#dis.opmap" title="Link to this definition"></a></dt>
<dd><p>Dictionary mapping operation names to bytecodes.</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.cmp_op">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">cmp_op</span></span><a class="headerlink" href="#dis.cmp_op" title="Link to this definition"></a></dt>
<dd><p>Sequence of all compare operation names.</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.hasarg">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">hasarg</span></span><a class="headerlink" href="#dis.hasarg" title="Link to this definition"></a></dt>
<dd><p>Sequence of bytecodes that use their argument.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.hasconst">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">hasconst</span></span><a class="headerlink" href="#dis.hasconst" title="Link to this definition"></a></dt>
<dd><p>Sequence of bytecodes that access a constant.</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.hasfree">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">hasfree</span></span><a class="headerlink" href="#dis.hasfree" title="Link to this definition"></a></dt>
<dd><p>Sequence of bytecodes that access a <a class="reference internal" href="../glossary.html#term-closure-variable"><span class="xref std std-term">free (closure) variable</span></a>.
free in this context refers to names in the current scope that are
referenced by inner scopes or names in outer scopes that are referenced
from this scope. It does <em>not</em> include references to global or builtin scopes.</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.hasname">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">hasname</span></span><a class="headerlink" href="#dis.hasname" title="Link to this definition"></a></dt>
<dd><p>Sequence of bytecodes that access an attribute by name.</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.hasjump">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">hasjump</span></span><a class="headerlink" href="#dis.hasjump" title="Link to this definition"></a></dt>
<dd><p>Sequence of bytecodes that have a jump target. All jumps
are relative.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.13.</span></p>
</div>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.haslocal">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">haslocal</span></span><a class="headerlink" href="#dis.haslocal" title="Link to this definition"></a></dt>
<dd><p>Sequence of bytecodes that access a local variable.</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.hascompare">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">hascompare</span></span><a class="headerlink" href="#dis.hascompare" title="Link to this definition"></a></dt>
<dd><p>Sequence of bytecodes of Boolean operations.</p>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.hasexc">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">hasexc</span></span><a class="headerlink" href="#dis.hasexc" title="Link to this definition"></a></dt>
<dd><p>Sequence of bytecodes that set an exception handler.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.12.</span></p>
</div>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.hasjrel">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">hasjrel</span></span><a class="headerlink" href="#dis.hasjrel" title="Link to this definition"></a></dt>
<dd><p>Sequence of bytecodes that have a relative jump target.</p>
<div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 3.13: </span>All jumps are now relative. Use <a class="reference internal" href="#dis.hasjump" title="dis.hasjump"><code class="xref py py-data docutils literal notranslate"><span class="pre">hasjump</span></code></a>.</p>
</div>
</dd></dl>
<dl class="py data">
<dt class="sig sig-object py" id="dis.hasjabs">
<span class="sig-prename descclassname"><span class="pre">dis.</span></span><span class="sig-name descname"><span class="pre">hasjabs</span></span><a class="headerlink" href="#dis.hasjabs" title="Link to this definition"></a></dt>
<dd><p>Sequence of bytecodes that have an absolute jump target.</p>
<div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 3.13: </span>All jumps are now relative. This list is empty.</p>
</div>
</dd></dl>
</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="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">dis</span></code> — Disassembler for Python bytecode</a><ul>
<li><a class="reference internal" href="#command-line-interface">Command-line interface</a></li>
<li><a class="reference internal" href="#bytecode-analysis">Bytecode analysis</a></li>
<li><a class="reference internal" href="#analysis-functions">Analysis functions</a></li>
<li><a class="reference internal" href="#python-bytecode-instructions">Python Bytecode Instructions</a></li>
<li><a class="reference internal" href="#opcode-collections">Opcode collections</a></li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="compileall.html"
title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">compileall</span></code> — Byte-compile Python libraries</a></p>
</div>
<div>
<h4>Next topic</h4>
<p class="topless"><a href="pickletools.html"
title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pickletools</span></code> — Tools for pickle developers</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/library/dis.rst"
rel="nofollow">Show Source
</a>
</li>
</ul>
</div>
</div>
<div id="sidebarbutton" title="Collapse sidebar">
<span>«</span>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="Related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="pickletools.html" title="pickletools — Tools for pickle developers"
>next</a> |</li>
<li class="right" >
<a href="compileall.html" title="compileall — Byte-compile Python libraries"
>previous</a> |</li>
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> &#187;</li>
<li class="switchers">
<div class="language_switcher_placeholder"></div>
<div class="version_switcher_placeholder"></div>
</li>
<li>
</li>
<li id="cpython-language-and-version">
<a href="../index.html">3.13.3 Documentation</a> &#187;
</li>
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
<li class="nav-item nav-item-2"><a href="language.html" >Python Language Services</a> &#187;</li>
<li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">dis</span></code> — Disassembler for Python bytecode</a></li>
<li class="right">
<div class="inline-search" role="search">
<form class="inline-search" action="../search.html" method="get">
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
<input type="submit" value="Go" />
</form>
</div>
|
</li>
<li class="right">
<label class="theme-selector-label">
Theme
<select class="theme-selector" oninput="activateTheme(this.value)">
<option value="auto" selected>Auto</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</label> |</li>
</ul>
</div>
<div class="footer">
&copy;
<a href="../copyright.html">
Copyright
</a>
2001-2025, 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 Apr 08, 2025 (14:33 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>