]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-32822: Add finally with return/break/continue to the tutorial (#25600)
authorRoberto Hueso <robertohueso96@gmail.com>
Tue, 4 May 2021 12:36:01 +0000 (14:36 +0200)
committerGitHub <noreply@github.com>
Tue, 4 May 2021 12:36:01 +0000 (14:36 +0200)
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.

Doc/tutorial/errors.rst
Misc/ACKS

index 25bb4fc567b95bc7ff9b8d6a533c7df2946b53e2..cd5fc878f9c946be6fccb3e4c56871102ca13d66 100644 (file)
@@ -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
index fb84c00622c314466e298f1ead552424e429f189..9f861b374221dc5dfa20105548b6a50bd7bca608 100644 (file)
--- 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