Skip to content

Commit f88bf2c

Browse files
miss-islingtonJamesParrottbrianschubertAA-Turner
authored
[3.13] gh-138297 Point link in docs for finally to try/else, instead of if/else (GH-138298) (#138382)
Co-authored-by: James Parrott <[email protected]> Co-authored-by: Brian Schubert <[email protected]> Co-authored-by: Adam Turner <[email protected]>
1 parent 406a81f commit f88bf2c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Doc/reference/compound_stmts.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,14 @@ clauses.
413413
--------------------------
414414

415415
If :keyword:`!finally` is present, it specifies a 'cleanup' handler. The
416-
:keyword:`try` clause is executed, including any :keyword:`except` and
417-
:keyword:`else` clauses. If an exception occurs in any of the clauses and is
418-
not handled, the exception is temporarily saved. The :keyword:`!finally` clause
419-
is executed. If there is a saved exception it is re-raised at the end of the
420-
:keyword:`!finally` clause. If the :keyword:`!finally` clause raises another
421-
exception, the saved exception is set as the context of the new exception.
416+
:keyword:`try` clause is executed, including any :keyword:`except`
417+
and :keyword:`else <except_else>` clauses.
418+
If an exception occurs in any of the clauses and is not handled,
419+
the exception is temporarily saved.
420+
The :keyword:`!finally` clause is executed. If there is a saved exception
421+
it is re-raised at the end of the :keyword:`!finally` clause.
422+
If the :keyword:`!finally` clause raises another exception, the saved exception
423+
is set as the context of the new exception.
422424
If the :keyword:`!finally` clause executes a :keyword:`return`, :keyword:`break`
423425
or :keyword:`continue` statement, the saved exception is discarded::
424426

0 commit comments

Comments
 (0)