peps/pep-3110/index.html

404 lines
31 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="color-scheme" content="light dark">
<title>PEP 3110 Catching Exceptions in Python 3000 | peps.python.org</title>
<link rel="shortcut icon" href="../_static/py.png">
<link rel="canonical" href="https://peps.python.org/pep-3110/">
<link rel="stylesheet" href="../_static/style.css" type="text/css">
<link rel="stylesheet" href="../_static/mq.css" type="text/css">
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" media="(prefers-color-scheme: light)" id="pyg-light">
<link rel="stylesheet" href="../_static/pygments_dark.css" type="text/css" media="(prefers-color-scheme: dark)" id="pyg-dark">
<link rel="alternate" type="application/rss+xml" title="Latest PEPs" href="https://peps.python.org/peps.rss">
<meta property="og:title" content='PEP 3110 Catching Exceptions in Python 3000 | peps.python.org'>
<meta property="og:type" content="website">
<meta property="og:url" content="https://peps.python.org/pep-3110/">
<meta property="og:site_name" content="Python Enhancement Proposals (PEPs)">
<meta property="og:image" content="https://peps.python.org/_static/og-image.png">
<meta property="og:image:alt" content="Python PEPs">
<meta property="og:image:width" content="200">
<meta property="og:image:height" content="200">
<meta name="description" content="Python Enhancement Proposals (PEPs)">
<meta name="theme-color" content="#3776ab">
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="svg-sun-half" viewBox="0 0 24 24" pointer-events="all">
<title>Following system colour scheme</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="9"></circle>
<path d="M12 3v18m0-12l4.65-4.65M12 14.3l7.37-7.37M12 19.6l8.85-8.85"></path>
</svg>
</symbol>
<symbol id="svg-moon" viewBox="0 0 24 24" pointer-events="all">
<title>Selected dark colour scheme</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z"></path>
</svg>
</symbol>
<symbol id="svg-sun" viewBox="0 0 24 24" pointer-events="all">
<title>Selected light colour scheme</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</symbol>
</svg>
<script>
document.documentElement.dataset.colour_scheme = localStorage.getItem("colour_scheme") || "auto"
</script>
<section id="pep-page-section">
<header>
<h1>Python Enhancement Proposals</h1>
<ul class="breadcrumbs">
<li><a href="https://www.python.org/" title="The Python Programming Language">Python</a> &raquo; </li>
<li><a href="../pep-0000/">PEP Index</a> &raquo; </li>
<li>PEP 3110</li>
</ul>
<button id="colour-scheme-cycler" onClick="setColourScheme(nextColourScheme())">
<svg aria-hidden="true" class="colour-scheme-icon-when-auto"><use href="#svg-sun-half"></use></svg>
<svg aria-hidden="true" class="colour-scheme-icon-when-dark"><use href="#svg-moon"></use></svg>
<svg aria-hidden="true" class="colour-scheme-icon-when-light"><use href="#svg-sun"></use></svg>
<span class="visually-hidden">Toggle light / dark / auto colour theme</span>
</button>
</header>
<article>
<section id="pep-content">
<h1 class="page-title">PEP 3110 Catching Exceptions in Python 3000</h1>
<dl class="rfc2822 field-list simple">
<dt class="field-odd">Author<span class="colon">:</span></dt>
<dd class="field-odd">Collin Winter &lt;collinwinter&#32;&#97;t&#32;google.com&gt;</dd>
<dt class="field-even">Status<span class="colon">:</span></dt>
<dd class="field-even"><abbr title="Accepted and implementation complete, or no longer active">Final</abbr></dd>
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><abbr title="Normative PEP with a new feature for Python, implementation change for CPython or interoperability standard for the ecosystem">Standards Track</abbr></dd>
<dt class="field-even">Created<span class="colon">:</span></dt>
<dd class="field-even">16-Jan-2006</dd>
<dt class="field-odd">Python-Version<span class="colon">:</span></dt>
<dd class="field-odd">3.0</dd>
<dt class="field-even">Post-History<span class="colon">:</span></dt>
<dd class="field-even"><p></p></dd>
</dl>
<hr class="docutils" />
<section id="contents">
<details><summary>Table of Contents</summary><ul class="simple">
<li><a class="reference internal" href="#abstract">Abstract</a></li>
<li><a class="reference internal" href="#rationale">Rationale</a></li>
<li><a class="reference internal" href="#grammar-changes">Grammar Changes</a></li>
<li><a class="reference internal" href="#semantic-changes">Semantic Changes</a></li>
<li><a class="reference internal" href="#compatibility-issues">Compatibility Issues</a><ul>
<li><a class="reference internal" href="#compatibility">2.6 - 3.0 Compatibility</a></li>
</ul>
</li>
<li><a class="reference internal" href="#open-issues">Open Issues</a><ul>
<li><a class="reference internal" href="#replacing-or-dropping-sys-exc-info">Replacing or Dropping “sys.exc_info()”</a></li>
</ul>
</li>
<li><a class="reference internal" href="#implementation">Implementation</a></li>
<li><a class="reference internal" href="#references">References</a></li>
<li><a class="reference internal" href="#copyright">Copyright</a></li>
</ul>
</details></section>
<section id="abstract">
<h2><a class="toc-backref" href="#abstract" role="doc-backlink">Abstract</a></h2>
<p>This PEP introduces changes intended to help eliminate ambiguities
in Pythons grammar, simplify exception classes, simplify garbage
collection for exceptions and reduce the size of the language in
Python 3.0.</p>
</section>
<section id="rationale">
<h2><a class="toc-backref" href="#rationale" role="doc-backlink">Rationale</a></h2>
<ol class="arabic">
<li><code class="docutils literal notranslate"><span class="pre">except</span></code> clauses in Python 2.x present a syntactic ambiguity
where the parser cannot differentiate whether<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">except</span> <span class="o">&lt;</span><span class="n">expression</span><span class="o">&gt;</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">expression</span><span class="o">&gt;</span><span class="p">:</span>
</pre></div>
</div>
<p>should be interpreted as</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">except</span> <span class="o">&lt;</span><span class="nb">type</span><span class="o">&gt;</span><span class="p">,</span> <span class="o">&lt;</span><span class="nb">type</span><span class="o">&gt;</span><span class="p">:</span>
</pre></div>
</div>
<p>or</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">except</span> <span class="o">&lt;</span><span class="nb">type</span><span class="o">&gt;</span><span class="p">,</span> <span class="o">&lt;</span><span class="n">name</span><span class="o">&gt;</span><span class="p">:</span>
</pre></div>
</div>
<p>Python 2 opts for the latter semantic, at the cost of requiring the
former to be parenthesized, like so</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">except</span> <span class="p">(</span><span class="o">&lt;</span><span class="nb">type</span><span class="o">&gt;</span><span class="p">,</span> <span class="o">&lt;</span><span class="nb">type</span><span class="o">&gt;</span><span class="p">):</span>
</pre></div>
</div>
</li>
<li>As specified in <a class="pep reference internal" href="../pep-0352/" title="PEP 352 Required Superclass for Exceptions">PEP 352</a>, the ability to treat exceptions
as tuples will be removed, meaning this code will no longer work<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">except</span> <span class="n">os</span><span class="o">.</span><span class="n">error</span><span class="p">,</span> <span class="p">(</span><span class="n">errno</span><span class="p">,</span> <span class="n">errstr</span><span class="p">):</span>
</pre></div>
</div>
<p>Because the automatic unpacking will no longer be possible, it is
desirable to remove the ability to use tuples as <code class="docutils literal notranslate"><span class="pre">except</span></code> targets.</p>
</li>
<li>As specified in <a class="pep reference internal" href="../pep-0344/" title="PEP 344 Exception Chaining and Embedded Tracebacks">PEP 344</a>, exception instances in Python 3
will possess a <code class="docutils literal notranslate"><span class="pre">__traceback__</span></code> attribute. The Open Issues section
of that PEP includes a paragraph on garbage collection difficulties
caused by this attribute, namely a “exception -&gt; traceback -&gt;
stack frame -&gt; exception” reference cycle, whereby all locals are
kept in scope until the next GC run. This PEP intends to resolve
this issue by adding a cleanup semantic to <code class="docutils literal notranslate"><span class="pre">except</span></code> clauses in
Python 3 whereby the target name is deleted at the end of the
<code class="docutils literal notranslate"><span class="pre">except</span></code> suite.</li>
<li>In the spirit of <a class="pep reference internal" href="../pep-0020/" title="PEP 20 The Zen of Python">“there should be one and preferably only one
obvious way to do it”</a>, it is desirable to consolidate
duplicate functionality. To this end, the <code class="docutils literal notranslate"><span class="pre">exc_value</span></code>,
<code class="docutils literal notranslate"><span class="pre">exc_type</span></code> and <code class="docutils literal notranslate"><span class="pre">exc_traceback</span></code> attributes of the <code class="docutils literal notranslate"><span class="pre">sys</span></code>
module <a class="footnote-reference brackets" href="#sys-module" id="id1">[1]</a> will be removed in favor of
<code class="docutils literal notranslate"><span class="pre">sys.exc_info()</span></code>, which provides the same information. These
attributes are already listed in <a class="pep reference internal" href="../pep-3100/" title="PEP 3100 Miscellaneous Python 3.0 Plans">PEP 3100</a> as targeted
for removal.</li>
</ol>
</section>
<section id="grammar-changes">
<h2><a class="toc-backref" href="#grammar-changes" role="doc-backlink">Grammar Changes</a></h2>
<p>In Python 3, the grammar for <code class="docutils literal notranslate"><span class="pre">except</span></code> statements will change
from <a class="footnote-reference brackets" href="#grammar" id="id2">[4]</a></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">except_clause</span><span class="p">:</span> <span class="s1">&#39;except&#39;</span> <span class="p">[</span><span class="n">test</span> <span class="p">[</span><span class="s1">&#39;,&#39;</span> <span class="n">test</span><span class="p">]]</span>
</pre></div>
</div>
<p>to</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">except_clause</span><span class="p">:</span> <span class="s1">&#39;except&#39;</span> <span class="p">[</span><span class="n">test</span> <span class="p">[</span><span class="s1">&#39;as&#39;</span> <span class="n">NAME</span><span class="p">]]</span>
</pre></div>
</div>
<p>The use of <code class="docutils literal notranslate"><span class="pre">as</span></code> in place of the comma token means that</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">except</span> <span class="p">(</span><span class="ne">AttributeError</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">error</span><span class="p">):</span>
</pre></div>
</div>
<p>can be clearly understood as a tuple of exception classes. This new
syntax was first proposed by Greg Ewing <a class="footnote-reference brackets" href="#firstproposal" id="id3">[2]</a> and
endorsed (<a class="footnote-reference brackets" href="#firstproposal" id="id4">[2]</a>, <a class="footnote-reference brackets" href="#renaming" id="id5">[3]</a>) by the BDFL.</p>
<p>Further, the restriction of the token following <code class="docutils literal notranslate"><span class="pre">as</span></code> from <code class="docutils literal notranslate"><span class="pre">test</span></code>
to <code class="docutils literal notranslate"><span class="pre">NAME</span></code> means that only valid identifiers can be used as
<code class="docutils literal notranslate"><span class="pre">except</span></code> targets.</p>
<p>Note that the grammar above always requires parenthesized tuples as
exception classes. That way, the ambiguous</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">except</span> <span class="n">A</span><span class="p">,</span> <span class="n">B</span><span class="p">:</span>
</pre></div>
</div>
<p>which would mean different things in Python 2.x and 3.x leading to
hard-to-catch bugs cannot legally occur in 3.x code.</p>
</section>
<section id="semantic-changes">
<h2><a class="toc-backref" href="#semantic-changes" role="doc-backlink">Semantic Changes</a></h2>
<p>In order to resolve the garbage collection issue related to <a class="pep reference internal" href="../pep-0344/" title="PEP 344 Exception Chaining and Embedded Tracebacks">PEP 344</a>,
<code class="docutils literal notranslate"><span class="pre">except</span></code> statements in Python 3 will generate additional bytecode to
delete the target, thus eliminating the reference cycle.
The source-to-source translation, as suggested by Phillip J. Eby
<a class="footnote-reference brackets" href="#except-translation" id="id6">[5]</a>, is</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">try</span><span class="p">:</span>
<span class="n">try_body</span>
<span class="k">except</span> <span class="n">E</span> <span class="k">as</span> <span class="n">N</span><span class="p">:</span>
<span class="n">except_body</span>
<span class="o">...</span>
</pre></div>
</div>
<p>gets translated to (in Python 2.5 terms)</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">try</span><span class="p">:</span>
<span class="n">try_body</span>
<span class="k">except</span> <span class="n">E</span><span class="p">,</span> <span class="n">N</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">except_body</span>
<span class="k">finally</span><span class="p">:</span>
<span class="n">N</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">del</span> <span class="n">N</span>
<span class="o">...</span>
</pre></div>
</div>
<p>An implementation has already been checked into the py3k (formerly
“p3yk”) branch <a class="footnote-reference brackets" href="#translation-checkin" id="id7">[6]</a>.</p>
</section>
<section id="compatibility-issues">
<h2><a class="toc-backref" href="#compatibility-issues" role="doc-backlink">Compatibility Issues</a></h2>
<p>Nearly all <code class="docutils literal notranslate"><span class="pre">except</span></code> clauses will need to be changed. <code class="docutils literal notranslate"><span class="pre">except</span></code>
clauses with identifier targets will be converted from</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">except</span> <span class="n">E</span><span class="p">,</span> <span class="n">N</span><span class="p">:</span>
</pre></div>
</div>
<p>to</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">except</span> <span class="n">E</span> <span class="k">as</span> <span class="n">N</span><span class="p">:</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">except</span></code> clauses with non-tuple, non-identifier targets
(e.g., <code class="docutils literal notranslate"><span class="pre">a.b.c[d]</span></code>) will need to be converted from</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">except</span> <span class="n">E</span><span class="p">,</span> <span class="n">T</span><span class="p">:</span>
</pre></div>
</div>
<p>to</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">except</span> <span class="n">E</span> <span class="k">as</span> <span class="n">t</span><span class="p">:</span>
<span class="n">T</span> <span class="o">=</span> <span class="n">t</span>
</pre></div>
</div>
<p>Both of these cases can be handled by Guido van Rossums <code class="docutils literal notranslate"><span class="pre">2to3</span></code>
utility <a class="footnote-reference brackets" href="#to3" id="id8">[7]</a> using the <code class="docutils literal notranslate"><span class="pre">except</span></code> fixer <a class="footnote-reference brackets" href="#exceptfixer" id="id9">[8]</a>.</p>
<p><code class="docutils literal notranslate"><span class="pre">except</span></code> clauses with tuple targets will need to be converted
manually, on a case-by-case basis. These changes will usually need
to be accompanied by changes to the exception classes themselves.
While these changes generally cannot be automated, the <code class="docutils literal notranslate"><span class="pre">2to3</span></code>
utility is able to point out cases where the target of an <code class="docutils literal notranslate"><span class="pre">except</span></code>
clause is a tuple, simplifying conversion.</p>
<p>Situations where it is necessary to keep an exception instance around
past the end of the <code class="docutils literal notranslate"><span class="pre">except</span></code> suite can be easily translated like so</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">try</span><span class="p">:</span>
<span class="o">...</span>
<span class="k">except</span> <span class="n">E</span> <span class="k">as</span> <span class="n">N</span><span class="p">:</span>
<span class="o">...</span>
<span class="o">...</span>
</pre></div>
</div>
<p>becomes</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">try</span><span class="p">:</span>
<span class="o">...</span>
<span class="k">except</span> <span class="n">E</span> <span class="k">as</span> <span class="n">N</span><span class="p">:</span>
<span class="n">n</span> <span class="o">=</span> <span class="n">N</span>
<span class="o">...</span>
<span class="o">...</span>
</pre></div>
</div>
<p>This way, when <code class="docutils literal notranslate"><span class="pre">N</span></code> is deleted at the end of the block, <code class="docutils literal notranslate"><span class="pre">n</span></code> will
persist and can be used as normal.</p>
<p>Lastly, all uses of the <code class="docutils literal notranslate"><span class="pre">sys</span></code> modules <code class="docutils literal notranslate"><span class="pre">exc_type</span></code>, <code class="docutils literal notranslate"><span class="pre">exc_value</span></code>
and <code class="docutils literal notranslate"><span class="pre">exc_traceback</span></code> attributes will need to be removed. They can be
replaced with <code class="docutils literal notranslate"><span class="pre">sys.exc_info()[0]</span></code>, <code class="docutils literal notranslate"><span class="pre">sys.exc_info()[1]</span></code> and
<code class="docutils literal notranslate"><span class="pre">sys.exc_info()[2]</span></code> respectively, a transformation that can be
performed by <code class="docutils literal notranslate"><span class="pre">2to3</span></code>s <code class="docutils literal notranslate"><span class="pre">sysexcattrs</span></code> fixer.</p>
<section id="compatibility">
<h3><a class="toc-backref" href="#compatibility" role="doc-backlink">2.6 - 3.0 Compatibility</a></h3>
<p>In order to facilitate forwards compatibility between Python 2.6 and 3.0,
the <code class="docutils literal notranslate"><span class="pre">except</span> <span class="pre">...</span> <span class="pre">as</span> <span class="pre">...:</span></code> syntax will be backported to the 2.x series. The
grammar will thus change from:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">except_clause</span><span class="p">:</span> <span class="s1">&#39;except&#39;</span> <span class="p">[</span><span class="n">test</span> <span class="p">[</span><span class="s1">&#39;,&#39;</span> <span class="n">test</span><span class="p">]]</span>
</pre></div>
</div>
<p>to:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">except_clause</span><span class="p">:</span> <span class="s1">&#39;except&#39;</span> <span class="p">[</span><span class="n">test</span> <span class="p">[(</span><span class="s1">&#39;as&#39;</span> <span class="o">|</span> <span class="s1">&#39;,&#39;</span><span class="p">)</span> <span class="n">test</span><span class="p">]]</span>
</pre></div>
</div>
<p>The end-of-suite cleanup semantic for <code class="docutils literal notranslate"><span class="pre">except</span></code> statements will not be
included in the 2.x series of releases.</p>
</section>
</section>
<section id="open-issues">
<h2><a class="toc-backref" href="#open-issues" role="doc-backlink">Open Issues</a></h2>
<section id="replacing-or-dropping-sys-exc-info">
<h3><a class="toc-backref" href="#replacing-or-dropping-sys-exc-info" role="doc-backlink">Replacing or Dropping “sys.exc_info()”</a></h3>
<p>The idea of dropping <code class="docutils literal notranslate"><span class="pre">sys.exc_info()</span></code> or replacing it with a
<code class="docutils literal notranslate"><span class="pre">sys.exception</span></code> attribute or a <code class="docutils literal notranslate"><span class="pre">sys.get_exception()</span></code> function
has been raised several times on python-3000 (<a class="footnote-reference brackets" href="#drop-excinfo" id="id10">[9]</a>,
<a class="footnote-reference brackets" href="#replace-excinfo" id="id11">[10]</a>) and mentioned in <a class="pep reference internal" href="../pep-0344/" title="PEP 344 Exception Chaining and Embedded Tracebacks">PEP 344</a>s “Open Issues” section.</p>
<p>While a <code class="docutils literal notranslate"><span class="pre">2to3</span></code> fixer to replace calls to <code class="docutils literal notranslate"><span class="pre">sys.exc_info()</span></code>
and some attribute accesses would be trivial, it would be far more
difficult for static analysis to find and fix functions that expect
the values from <code class="docutils literal notranslate"><span class="pre">sys.exc_info()</span></code> as arguments. Similarly, this does
not address the need to rewrite the documentation for all APIs that
are defined in terms of <code class="docutils literal notranslate"><span class="pre">sys.exc_info()</span></code>.</p>
</section>
</section>
<section id="implementation">
<h2><a class="toc-backref" href="#implementation" role="doc-backlink">Implementation</a></h2>
<p>This PEP was implemented in revisions 53342 <a class="footnote-reference brackets" href="#r53342" id="id12">[11]</a> and 53349
<a class="footnote-reference brackets" href="#r53349" id="id13">[12]</a>. Support for the new <code class="docutils literal notranslate"><span class="pre">except</span></code> syntax in 2.6 was
implemented in revision 55446 <a class="footnote-reference brackets" href="#r55446" id="id14">[13]</a>.</p>
</section>
<section id="references">
<h2><a class="toc-backref" href="#references" role="doc-backlink">References</a></h2>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="sys-module" role="doc-footnote">
<dt class="label" id="sys-module">[<a href="#id1">1</a>]</dt>
<dd><a class="reference external" href="http://docs.python.org/library/sys.html">http://docs.python.org/library/sys.html</a></aside>
<aside class="footnote brackets" id="firstproposal" role="doc-footnote">
<dt class="label" id="firstproposal">[2]<em> (<a href='#id3'>1</a>, <a href='#id4'>2</a>) </em></dt>
<dd><a class="reference external" href="https://mail.python.org/pipermail/python-dev/2006-March/062449.html">https://mail.python.org/pipermail/python-dev/2006-March/062449.html</a></aside>
<aside class="footnote brackets" id="renaming" role="doc-footnote">
<dt class="label" id="renaming">[<a href="#id5">3</a>]</dt>
<dd><a class="reference external" href="https://mail.python.org/pipermail/python-dev/2006-March/062640.html">https://mail.python.org/pipermail/python-dev/2006-March/062640.html</a></aside>
<aside class="footnote brackets" id="grammar" role="doc-footnote">
<dt class="label" id="grammar">[<a href="#id2">4</a>]</dt>
<dd><a class="reference external" href="http://docs.python.org/reference/compound_stmts.html#try">http://docs.python.org/reference/compound_stmts.html#try</a></aside>
<aside class="footnote brackets" id="except-translation" role="doc-footnote">
<dt class="label" id="except-translation">[<a href="#id6">5</a>]</dt>
<dd><a class="reference external" href="https://mail.python.org/pipermail/python-3000/2007-January/005395.html">https://mail.python.org/pipermail/python-3000/2007-January/005395.html</a></aside>
<aside class="footnote brackets" id="translation-checkin" role="doc-footnote">
<dt class="label" id="translation-checkin">[<a href="#id7">6</a>]</dt>
<dd><a class="reference external" href="http://svn.python.org/view?rev=53342&amp;view=rev">http://svn.python.org/view?rev=53342&amp;view=rev</a></aside>
<aside class="footnote brackets" id="to3" role="doc-footnote">
<dt class="label" id="to3">[<a href="#id8">7</a>]</dt>
<dd><a class="reference external" href="https://hg.python.org/sandbox/guido/file/2.7/Lib/lib2to3/">https://hg.python.org/sandbox/guido/file/2.7/Lib/lib2to3/</a></aside>
<aside class="footnote brackets" id="exceptfixer" role="doc-footnote">
<dt class="label" id="exceptfixer">[<a href="#id9">8</a>]</dt>
<dd><a class="reference external" href="https://hg.python.org/sandbox/guido/file/2.7/Lib/lib2to3/fixes/fix_except.py">https://hg.python.org/sandbox/guido/file/2.7/Lib/lib2to3/fixes/fix_except.py</a></aside>
<aside class="footnote brackets" id="drop-excinfo" role="doc-footnote">
<dt class="label" id="drop-excinfo">[<a href="#id10">9</a>]</dt>
<dd><a class="reference external" href="https://mail.python.org/pipermail/python-3000/2007-January/005385.html">https://mail.python.org/pipermail/python-3000/2007-January/005385.html</a></aside>
<aside class="footnote brackets" id="replace-excinfo" role="doc-footnote">
<dt class="label" id="replace-excinfo">[<a href="#id11">10</a>]</dt>
<dd><a class="reference external" href="https://mail.python.org/pipermail/python-3000/2007-January/005604.html">https://mail.python.org/pipermail/python-3000/2007-January/005604.html</a></aside>
<aside class="footnote brackets" id="r53342" role="doc-footnote">
<dt class="label" id="r53342">[<a href="#id12">11</a>]</dt>
<dd><a class="reference external" href="http://svn.python.org/view?view=revision&amp;revision=53342">http://svn.python.org/view?view=revision&amp;revision=53342</a></aside>
<aside class="footnote brackets" id="r53349" role="doc-footnote">
<dt class="label" id="r53349">[<a href="#id13">12</a>]</dt>
<dd><a class="reference external" href="http://svn.python.org/view?view=revision&amp;revision=53349">http://svn.python.org/view?view=revision&amp;revision=53349</a></aside>
<aside class="footnote brackets" id="r55446" role="doc-footnote">
<dt class="label" id="r55446">[<a href="#id14">13</a>]</dt>
<dd><a class="reference external" href="http://svn.python.org/view/python/trunk/?view=rev&amp;rev=55446">http://svn.python.org/view/python/trunk/?view=rev&amp;rev=55446</a></aside>
</aside>
</section>
<section id="copyright">
<h2><a class="toc-backref" href="#copyright" role="doc-backlink">Copyright</a></h2>
<p>This document has been placed in the public domain.</p>
</section>
</section>
<hr class="docutils" />
<p>Source: <a class="reference external" href="https://github.com/python/peps/blob/main/peps/pep-3110.rst">https://github.com/python/peps/blob/main/peps/pep-3110.rst</a></p>
<p>Last modified: <a class="reference external" href="https://github.com/python/peps/commits/main/peps/pep-3110.rst">2023-09-09 17:39:29 GMT</a></p>
</article>
<nav id="pep-sidebar">
<h2>Contents</h2>
<ul>
<li><a class="reference internal" href="#abstract">Abstract</a></li>
<li><a class="reference internal" href="#rationale">Rationale</a></li>
<li><a class="reference internal" href="#grammar-changes">Grammar Changes</a></li>
<li><a class="reference internal" href="#semantic-changes">Semantic Changes</a></li>
<li><a class="reference internal" href="#compatibility-issues">Compatibility Issues</a><ul>
<li><a class="reference internal" href="#compatibility">2.6 - 3.0 Compatibility</a></li>
</ul>
</li>
<li><a class="reference internal" href="#open-issues">Open Issues</a><ul>
<li><a class="reference internal" href="#replacing-or-dropping-sys-exc-info">Replacing or Dropping “sys.exc_info()”</a></li>
</ul>
</li>
<li><a class="reference internal" href="#implementation">Implementation</a></li>
<li><a class="reference internal" href="#references">References</a></li>
<li><a class="reference internal" href="#copyright">Copyright</a></li>
</ul>
<br>
<a id="source" href="https://github.com/python/peps/blob/main/peps/pep-3110.rst">Page Source (GitHub)</a>
</nav>
</section>
<script src="../_static/colour_scheme.js"></script>
<script src="../_static/wrap_tables.js"></script>
<script src="../_static/sticky_banner.js"></script>
</body>
</html>