python-peps/pep-0601/index.html

371 lines
29 KiB
HTML
Raw Permalink 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">
<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 601 Forbid return/break/continue breaking out of finally | peps.python.org</title>
<link rel="shortcut icon" href="../_static/py.png">
<link rel="canonical" href="https://peps.python.org/pep-0601/">
<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 601 Forbid return/break/continue breaking out of finally | peps.python.org'>
<meta property="og:description" content="This PEP proposes to forbid return, break and continue statements within a finally suite where they would break out of the finally. Their use in such a location silently cancels any active exception being raised through the finally, leading to unclear ...">
<meta property="og:type" content="website">
<meta property="og:url" content="https://peps.python.org/pep-0601/">
<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="This PEP proposes to forbid return, break and continue statements within a finally suite where they would break out of the finally. Their use in such a location silently cancels any active exception being raised through the finally, leading to unclear ...">
<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 601</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 601 Forbid return/break/continue breaking out of finally</h1>
<dl class="rfc2822 field-list simple">
<dt class="field-odd">Author<span class="colon">:</span></dt>
<dd class="field-odd">Damien George, Batuhan Taskaya</dd>
<dt class="field-even">Sponsor<span class="colon">:</span></dt>
<dd class="field-even">Alyssa Coghlan</dd>
<dt class="field-odd">Discussions-To<span class="colon">:</span></dt>
<dd class="field-odd"><a class="reference external" href="https://discuss.python.org/t/pep-601-forbid-return-break-continue-breaking-out-of-finally/2239">Discourse thread</a></dd>
<dt class="field-even">Status<span class="colon">:</span></dt>
<dd class="field-even"><abbr title="Formally declined and will not be accepted">Rejected</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">26-Aug-2019</dd>
<dt class="field-odd">Python-Version<span class="colon">:</span></dt>
<dd class="field-odd">3.8</dd>
<dt class="field-even">Post-History<span class="colon">:</span></dt>
<dd class="field-even">26-Aug-2019, 23-Sep-2019</dd>
<dt class="field-odd">Resolution<span class="colon">:</span></dt>
<dd class="field-odd"><a class="reference external" href="https://discuss.python.org/t/pep-601-forbid-return-break-continue-breaking-out-of-finally/2239/32">Discourse message</a></dd>
</dl>
<hr class="docutils" />
<section id="contents">
<details><summary>Table of Contents</summary><ul class="simple">
<li><a class="reference internal" href="#rejection-note">Rejection Note</a></li>
<li><a class="reference internal" href="#abstract">Abstract</a></li>
<li><a class="reference internal" href="#motivation">Motivation</a></li>
<li><a class="reference internal" href="#other-languages">Other languages</a></li>
<li><a class="reference internal" href="#rationale">Rationale</a></li>
<li><a class="reference internal" href="#specification">Specification</a></li>
<li><a class="reference internal" href="#backwards-compatibility">Backwards Compatibility</a></li>
<li><a class="reference internal" href="#security-implications">Security Implications</a></li>
<li><a class="reference internal" href="#how-to-teach-this">How to Teach This</a></li>
<li><a class="reference internal" href="#reference-implementation">Reference 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="rejection-note">
<h2><a class="toc-backref" href="#rejection-note" role="doc-backlink">Rejection Note</a></h2>
<p>This PEP was rejected by the Steering Council by a vote of 4/4.</p>
<p>Guidos arguments for rejecting the PEP are: “it seems to me that most languages
implement this kind of construct but have style guides and/or linters that
reject it. I would support a proposal to add this to <a class="pep reference internal" href="../pep-0008/" title="PEP 8 Style Guide for Python Code">PEP 8</a>”, and “I note that
the toy examples are somewhat misleading the functionality that may be useful
is a conditional return (or break etc.) inside a finally block.”.</p>
</section>
<section id="abstract">
<h2><a class="toc-backref" href="#abstract" role="doc-backlink">Abstract</a></h2>
<p>This PEP proposes to forbid <code class="docutils literal notranslate"><span class="pre">return</span></code>, <code class="docutils literal notranslate"><span class="pre">break</span></code> and <code class="docutils literal notranslate"><span class="pre">continue</span></code> statements within
a <code class="docutils literal notranslate"><span class="pre">finally</span></code> suite where they would break out of the <code class="docutils literal notranslate"><span class="pre">finally</span></code>. Their use in
such a location silently cancels any active exception being raised through
the <code class="docutils literal notranslate"><span class="pre">finally</span></code>, leading to unclear code and possible bugs.</p>
<p><code class="docutils literal notranslate"><span class="pre">continue</span></code> is currently not supported in a <code class="docutils literal notranslate"><span class="pre">finally</span></code> in Python 3.7 (due to
implementation issues) and the proposal is to not add support for it in
Python 3.8. For <code class="docutils literal notranslate"><span class="pre">return</span></code> and <code class="docutils literal notranslate"><span class="pre">break</span></code> the proposal is to deprecate their use
in Python 3.9, emit a compilation warning in Python 3.10 and then forbid
their use after that.</p>
</section>
<section id="motivation">
<h2><a class="toc-backref" href="#motivation" role="doc-backlink">Motivation</a></h2>
<p>The use of <code class="docutils literal notranslate"><span class="pre">return</span></code>, <code class="docutils literal notranslate"><span class="pre">break</span></code> and <code class="docutils literal notranslate"><span class="pre">continue</span></code> within a <code class="docutils literal notranslate"><span class="pre">finally</span></code> suite leads to behaviour
which is not at all obvious. Consider the following function:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">foo</span><span class="p">():</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">foo</span><span class="p">()</span>
<span class="k">finally</span><span class="p">:</span>
<span class="k">return</span>
</pre></div>
</div>
<p>This will return cleanly (without an exception) even though it has infinite
recursion and raises an exception within the <code class="docutils literal notranslate"><span class="pre">try</span></code>. The reason is that the <code class="docutils literal notranslate"><span class="pre">return</span></code>
within the <code class="docutils literal notranslate"><span class="pre">finally</span></code> will silently cancel any exception that propagates through
the <code class="docutils literal notranslate"><span class="pre">finally</span></code> suite. Such behaviour is unexpected and not at all obvious.
This function is equivalent to:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">foo</span><span class="p">():</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">foo</span><span class="p">()</span>
<span class="k">except</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">return</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">break</span></code> and <code class="docutils literal notranslate"><span class="pre">continue</span></code> have similar behaviour (they silence exceptions) if they
jump to code outside the <code class="docutils literal notranslate"><span class="pre">finally</span></code> suite. For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">bar</span><span class="p">():</span>
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="mi">1</span> <span class="o">/</span> <span class="mi">0</span>
<span class="k">finally</span><span class="p">:</span>
<span class="k">break</span>
</pre></div>
</div>
<p>This behaviour goes against the following parts of The Zen of Python:</p>
<ul class="simple">
<li>Explicit is better than implicit - exceptions are implicitly silenced</li>
<li>Readability counts - the intention of the code is not obvious</li>
<li>Errors should never pass silently; Unless explicitly silenced - exceptions
are implicitly silenced</li>
</ul>
<p>If this behaviour of silencing exceptions is really needed then the explicit
form of a try-except can be used instead, and this makes the code clearer.</p>
<p>Independent to the semantics, implementing <code class="docutils literal notranslate"><span class="pre">return</span></code>/<code class="docutils literal notranslate"><span class="pre">break</span></code>/<code class="docutils literal notranslate"><span class="pre">continue</span></code> within a
<code class="docutils literal notranslate"><span class="pre">finally</span></code> suite is non-trivial as it requires to correctly track any active
exceptions at runtime (an executing <code class="docutils literal notranslate"><span class="pre">finally</span></code> suite may or may not have an
active exception) and cancel them as appropriate. CPython did have a bug in
this for the case of <code class="docutils literal notranslate"><span class="pre">continue</span></code> and so originally disallowed it <a class="footnote-reference brackets" href="#id10" id="id1">[1]</a>. Requiring
correct behaviour for <code class="docutils literal notranslate"><span class="pre">return</span></code>/<code class="docutils literal notranslate"><span class="pre">break</span></code>/<code class="docutils literal notranslate"><span class="pre">continue</span></code> within a <code class="docutils literal notranslate"><span class="pre">finally</span></code> puts an
unnecessary burden on alternative implementations of Python.</p>
</section>
<section id="other-languages">
<h2><a class="toc-backref" href="#other-languages" role="doc-backlink">Other languages</a></h2>
<p>Java allows to return from within a <code class="docutils literal notranslate"><span class="pre">finally</span></code> block, but its use is discouraged
according to <a class="footnote-reference brackets" href="#id11" id="id2">[2]</a>, <a class="footnote-reference brackets" href="#id12" id="id3">[3]</a>, <a class="footnote-reference brackets" href="#id13" id="id4">[4]</a>. The Java compiler later on included a linting
option <code class="docutils literal notranslate"><span class="pre">-Xlint:finally</span></code> to warn against the use of return within a <code class="docutils literal notranslate"><span class="pre">finally</span></code> block.
The Eclipse editor also warns about this use.</p>
<p>Ruby allows return from inside ensure (Pythons finally), but it should be an
explicit return. It is discouraged and handled by linters <a class="footnote-reference brackets" href="#id14" id="id5">[5]</a>, <a class="footnote-reference brackets" href="#id15" id="id6">[6]</a>.</p>
<p>Like Ruby, JavaScript also allows use of <code class="docutils literal notranslate"><span class="pre">return</span></code>/<code class="docutils literal notranslate"><span class="pre">break</span></code>/<code class="docutils literal notranslate"><span class="pre">continue</span></code> within a <code class="docutils literal notranslate"><span class="pre">finally</span></code>
but it is seen as unsafe and it is handled by eslint <a class="footnote-reference brackets" href="#id16" id="id7">[7]</a>.</p>
<p>C# forbids the use of ending statements like <code class="docutils literal notranslate"><span class="pre">return</span></code>/<code class="docutils literal notranslate"><span class="pre">goto</span></code>/<code class="docutils literal notranslate"><span class="pre">break</span></code> within a <code class="docutils literal notranslate"><span class="pre">finally</span></code>
<a class="footnote-reference brackets" href="#id17" id="id8">[8]</a>, <a class="footnote-reference brackets" href="#id18" id="id9">[9]</a>.</p>
</section>
<section id="rationale">
<h2><a class="toc-backref" href="#rationale" role="doc-backlink">Rationale</a></h2>
<p>Since the behaviour of <code class="docutils literal notranslate"><span class="pre">return</span></code>/<code class="docutils literal notranslate"><span class="pre">break</span></code>/<code class="docutils literal notranslate"><span class="pre">continue</span></code> within a <code class="docutils literal notranslate"><span class="pre">finally</span></code> is unclear, the
pattern is rarely used, and there is a simple alternative to writing equivalent
code (which is more explicit), forbidding the syntax is the most straightforward
approach.</p>
</section>
<section id="specification">
<h2><a class="toc-backref" href="#specification" role="doc-backlink">Specification</a></h2>
<p>This is a change to the compiler, not the grammar. The compiler should
check for the following in a <code class="docutils literal notranslate"><span class="pre">finally</span></code> suite:</p>
<ul class="simple">
<li>A <code class="docutils literal notranslate"><span class="pre">return</span></code> in any statement, at any level of nesting.</li>
<li>A <code class="docutils literal notranslate"><span class="pre">break</span></code>/<code class="docutils literal notranslate"><span class="pre">continue</span></code> in any statement, at any level of nesting, that would
transfer control flow outside the <code class="docutils literal notranslate"><span class="pre">finally</span></code> suite.</li>
</ul>
<p>Upon finding such a case it should emit the appropriate exception:</p>
<ul class="simple">
<li>For <code class="docutils literal notranslate"><span class="pre">continue</span></code>, a <code class="docutils literal notranslate"><span class="pre">SyntaxError</span></code> (this is the current behaviour of 3.7).</li>
<li>For <code class="docutils literal notranslate"><span class="pre">return</span></code>/<code class="docutils literal notranslate"><span class="pre">break</span></code>, a <code class="docutils literal notranslate"><span class="pre">SyntaxWarning</span></code> in 3.10, and a <code class="docutils literal notranslate"><span class="pre">SyntaxError</span></code> after that.</li>
</ul>
<p>For example, the following are all forbidden by this proposal:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">f</span><span class="p">():</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">finally</span><span class="p">:</span>
<span class="k">return</span>
<span class="k">def</span> <span class="nf">g</span><span class="p">():</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">finally</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">return</span>
<span class="k">finally</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">def</span> <span class="nf">h</span><span class="p">():</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">finally</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">finally</span><span class="p">:</span>
<span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">10</span><span class="p">):</span>
<span class="k">return</span>
</pre></div>
</div>
<p>The following is still allowed because the <code class="docutils literal notranslate"><span class="pre">continue</span></code> doesnt escape the
<code class="docutils literal notranslate"><span class="pre">finally</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">try</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">finally</span><span class="p">:</span>
<span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">10</span><span class="p">):</span>
<span class="k">continue</span>
</pre></div>
</div>
<p>Note that yielding from within a <code class="docutils literal notranslate"><span class="pre">finally</span></code> remains acceptable by this PEP
because resuming the generator will resume the <code class="docutils literal notranslate"><span class="pre">finally</span></code> and eventually
raise any active exceptions (so they are never silenced by yielding).</p>
</section>
<section id="backwards-compatibility">
<h2><a class="toc-backref" href="#backwards-compatibility" role="doc-backlink">Backwards Compatibility</a></h2>
<p>This is a backwards incompatible change, for <code class="docutils literal notranslate"><span class="pre">return</span></code> and <code class="docutils literal notranslate"><span class="pre">break</span></code>.</p>
<p>The following locations in the CPython standard library (at
v3.8.0b1-651-g7fcc2088a5) use <code class="docutils literal notranslate"><span class="pre">return</span></code> within <code class="docutils literal notranslate"><span class="pre">finally</span></code>:</p>
<ul class="simple">
<li>Lib/subprocess.py:921 - the use here looks like a bug</li>
<li>Lib/multiprocessing/connection.py:316 - the use here looks legitimate
but the intention is not clear</li>
<li>Lib/multiprocessing/connection.py:318 - the use here looks legitimate
but the intention is not clear</li>
<li>Lib/test/test_sys_settrace.py:837 - a test for <code class="docutils literal notranslate"><span class="pre">return</span></code> within <code class="docutils literal notranslate"><span class="pre">finally</span></code></li>
<li>Lib/test/test_sys_settrace.py:1346 - a test for <code class="docutils literal notranslate"><span class="pre">return</span></code> within <code class="docutils literal notranslate"><span class="pre">finally</span></code></li>
</ul>
<p>There are no uses of <code class="docutils literal notranslate"><span class="pre">break</span></code> within a <code class="docutils literal notranslate"><span class="pre">finally</span></code> (that break out of the <code class="docutils literal notranslate"><span class="pre">finally</span></code>)
in the standard library.</p>
</section>
<section id="security-implications">
<h2><a class="toc-backref" href="#security-implications" role="doc-backlink">Security Implications</a></h2>
<p>This is a simplification of the language, and removal of associated code,
so should not introduce any new paths for a security exploit.</p>
</section>
<section id="how-to-teach-this">
<h2><a class="toc-backref" href="#how-to-teach-this" role="doc-backlink">How to Teach This</a></h2>
<p>This feature is very rarely used so forbidding it will likely only impact
advanced users, not beginners and probably not any existing teaching
material. Since this is the removal of a feature teaching users will be
one by the raising of a <code class="docutils literal notranslate"><span class="pre">SyntaxError</span></code> if/when the forbidden feature is used.</p>
</section>
<section id="reference-implementation">
<h2><a class="toc-backref" href="#reference-implementation" role="doc-backlink">Reference Implementation</a></h2>
<p>There is currently no reference implementation, although the way continue
is currently handled in a <code class="docutils literal notranslate"><span class="pre">finally</span></code> (raising a <code class="docutils literal notranslate"><span class="pre">SyntaxError</span></code>) can be extended
to <code class="docutils literal notranslate"><span class="pre">return</span></code> and <code class="docutils literal notranslate"><span class="pre">break</span></code>.</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="id10" role="doc-footnote">
<dt class="label" id="id10">[<a href="#id1">1</a>]</dt>
<dd><a class="reference external" href="https://github.com/python/cpython/issues/82011">https://github.com/python/cpython/issues/82011</a></aside>
<aside class="footnote brackets" id="id11" role="doc-footnote">
<dt class="label" id="id11">[<a href="#id2">2</a>]</dt>
<dd><a class="reference external" href="https://stackoverflow.com/questions/48088/returning-from-a-finally-block-in-java">https://stackoverflow.com/questions/48088/returning-from-a-finally-block-in-java</a></aside>
<aside class="footnote brackets" id="id12" role="doc-footnote">
<dt class="label" id="id12">[<a href="#id3">3</a>]</dt>
<dd><a class="reference external" href="https://web.archive.org/web/20070922061412/http://weblogs.java.net/blog/staufferjames/archive/2007/06/_dont_return_in.html">https://web.archive.org/web/20070922061412/http://weblogs.java.net/blog/staufferjames/archive/2007/06/_dont_return_in.html</a></aside>
<aside class="footnote brackets" id="id13" role="doc-footnote">
<dt class="label" id="id13">[<a href="#id4">4</a>]</dt>
<dd><a class="reference external" href="https://wiki.sei.cmu.edu/confluence/display/java/ERR04-J.+Do+not+complete+abruptly+from+a+finally+block">https://wiki.sei.cmu.edu/confluence/display/java/ERR04-J.+Do+not+complete+abruptly+from+a+finally+block</a></aside>
<aside class="footnote brackets" id="id14" role="doc-footnote">
<dt class="label" id="id14">[<a href="#id5">5</a>]</dt>
<dd><a class="reference external" href="https://github.com/rubocop/rubocop/issues/5949">https://github.com/rubocop/rubocop/issues/5949</a></aside>
<aside class="footnote brackets" id="id15" role="doc-footnote">
<dt class="label" id="id15">[<a href="#id6">6</a>]</dt>
<dd><a class="reference external" href="https://www.rubydoc.info/gems/rubocop/0.74.0/RuboCop/Cop/Lint/EnsureReturn">https://www.rubydoc.info/gems/rubocop/0.74.0/RuboCop/Cop/Lint/EnsureReturn</a></aside>
<aside class="footnote brackets" id="id16" role="doc-footnote">
<dt class="label" id="id16">[<a href="#id7">7</a>]</dt>
<dd><a class="reference external" href="https://eslint.org/docs/rules/no-unsafe-finally">https://eslint.org/docs/rules/no-unsafe-finally</a></aside>
<aside class="footnote brackets" id="id17" role="doc-footnote">
<dt class="label" id="id17">[<a href="#id8">8</a>]</dt>
<dd><a class="reference external" href="https://social.msdn.microsoft.com/Forums/vstudio/en-US/87faf259-3c54-4f3a-8d2b-ff82de44992f/return-statement-in-finally-block?forum=netfxbcl">https://social.msdn.microsoft.com/Forums/vstudio/en-US/87faf259-3c54-4f3a-8d2b-ff82de44992f/return-statement-in-finally-block?forum=netfxbcl</a></aside>
<aside class="footnote brackets" id="id18" role="doc-footnote">
<dt class="label" id="id18">[<a href="#id9">9</a>]</dt>
<dd><a class="reference external" href="https://stackoverflow.com/a/5788268">https://stackoverflow.com/a/5788268</a></aside>
</aside>
</section>
<section id="copyright">
<h2><a class="toc-backref" href="#copyright" role="doc-backlink">Copyright</a></h2>
<p>This document is placed in the public domain or under the
CC0-1.0-Universal license, whichever is more permissive.</p>
</section>
</section>
<hr class="docutils" />
<p>Source: <a class="reference external" href="https://github.com/python/peps/blob/main/peps/pep-0601.rst">https://github.com/python/peps/blob/main/peps/pep-0601.rst</a></p>
<p>Last modified: <a class="reference external" href="https://github.com/python/peps/commits/main/peps/pep-0601.rst">2023-10-11 12:05:51 GMT</a></p>
</article>
<nav id="pep-sidebar">
<h2>Contents</h2>
<ul>
<li><a class="reference internal" href="#rejection-note">Rejection Note</a></li>
<li><a class="reference internal" href="#abstract">Abstract</a></li>
<li><a class="reference internal" href="#motivation">Motivation</a></li>
<li><a class="reference internal" href="#other-languages">Other languages</a></li>
<li><a class="reference internal" href="#rationale">Rationale</a></li>
<li><a class="reference internal" href="#specification">Specification</a></li>
<li><a class="reference internal" href="#backwards-compatibility">Backwards Compatibility</a></li>
<li><a class="reference internal" href="#security-implications">Security Implications</a></li>
<li><a class="reference internal" href="#how-to-teach-this">How to Teach This</a></li>
<li><a class="reference internal" href="#reference-implementation">Reference 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-0601.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>