summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-05-04 13:17:21 (GMT)
committerGitHub <noreply@github.com>2021-05-04 13:17:21 (GMT)
commit91cb1e20e6a432b8b2c1b5db37b03c84b15384fa (patch)
tree8c1a7d208c859c816629dd8f8690e391b23bd28d
parent00726e51ade10c7e3535811eb700418725244230 (diff)
downloadcpython-91cb1e20e6a432b8b2c1b5db37b03c84b15384fa.zip
cpython-91cb1e20e6a432b8b2c1b5db37b03c84b15384fa.tar.gz
cpython-91cb1e20e6a432b8b2c1b5db37b03c84b15384fa.tar.bz2
bpo-32822: Add finally with return/break/continue to the tutorial (GH-25600) (#25890)
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@gmail.com>
-rw-r--r--Doc/tutorial/errors.rst4
-rw-r--r--Misc/ACKS1
2 files changed, 5 insertions, 0 deletions
diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst
index f72da5c..7bb0b48 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 389c8e1..be45273 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -766,6 +766,7 @@ Christian Hudon
BenoƮt Hudson
Lawrence Hudson
Michael Hudson
+Roberto Hueso Gomez
Jim Hugunin
Greg Humphreys
Chris Hunt