mirror of
https://github.com/python/cpython.git
synced 2025-12-09 18:48:05 +00:00
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:
parent
33d9bf298b
commit
a0b9915a8b
2 changed files with 5 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue