Skip to content

Commit a0b9915

Browse files
authored
bpo-32822: Add finally with return/break/continue to the tutorial (#25600)
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.
1 parent 33d9bf2 commit a0b9915

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Doc/tutorial/errors.rst

+4
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,10 @@ points discuss more complex cases when an exception occurs:
405405
or :keyword:`!else` clause. Again, the exception is re-raised after
406406
the :keyword:`!finally` clause has been executed.
407407

408+
* If the :keyword:`!finally` clause executes a :keyword:`break`,
409+
:keyword:`continue` or :keyword:`return` statement, exceptions are not
410+
re-raised.
411+
408412
* If the :keyword:`!try` statement reaches a :keyword:`break`,
409413
:keyword:`continue` or :keyword:`return` statement, the
410414
:keyword:`!finally` clause will execute just prior to the

Misc/ACKS

+1
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ Christian Hudon
778778
Benoît Hudson
779779
Lawrence Hudson
780780
Michael Hudson
781+
Roberto Hueso Gomez
781782
Jim Hugunin
782783
Greg Humphreys
783784
Chris Hunt

0 commit comments

Comments
 (0)