[Python-checkins] bpo-32822: Add finally with return/break/continue to the tutorial (GH-25600) (#25893)
ambv
webhook-mailer at python.org
Tue May 4 09:17:44 EDT 2021
https://github.com/python/cpython/commit/8655521de8760e8a695bcce92937800c079ea2b2
commit: 8655521de8760e8a695bcce92937800c079ea2b2
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: ambv <lukasz at langa.pl>
date: 2021-05-04T15:17:40+02:00
summary:
bpo-32822: Add finally with return/break/continue to the tutorial (GH-25600) (#25893)
This documents in the tutorial docs the behavior of a finally clause in
case it should re-raise an exception but contains a
return/break/continue statement.
(cherry picked from commit a0b9915a8be98427432e13d8eb2207a8b9824179)
Co-authored-by: Roberto Hueso <robertohueso96 at gmail.com>
files:
M Doc/tutorial/errors.rst
M Misc/ACKS
diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst
index 25bb4fc567b95b..cd5fc878f9c946 100644
--- a/Doc/tutorial/errors.rst
+++ b/Doc/tutorial/errors.rst
@@ -405,6 +405,10 @@ points discuss more complex cases when an exception occurs:
or :keyword:`!else` clause. Again, the exception is re-raised after
the :keyword:`!finally` clause has been executed.
+* If the :keyword:`!finally` clause executes a :keyword:`break`,
+ :keyword:`continue` or :keyword:`return` statement, exceptions are not
+ re-raised.
+
* If the :keyword:`!try` statement reaches a :keyword:`break`,
:keyword:`continue` or :keyword:`return` statement, the
:keyword:`!finally` clause will execute just prior to the
diff --git a/Misc/ACKS b/Misc/ACKS
index fb84c00622c314..9f861b374221dc 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -778,6 +778,7 @@ Christian Hudon
Benoît Hudson
Lawrence Hudson
Michael Hudson
+Roberto Hueso Gomez
Jim Hugunin
Greg Humphreys
Chris Hunt
More information about the Python-checkins
mailing list