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.
This commit is contained in:
Roberto Hueso 2021-05-04 14:36:01 +02:00 committed by GitHub
parent 33d9bf298b
commit a0b9915a8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View 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

View File

@ -778,6 +778,7 @@ Christian Hudon
Benoît Hudson
Lawrence Hudson
Michael Hudson
Roberto Hueso Gomez
Jim Hugunin
Greg Humphreys
Chris Hunt