Skip to content

Commit 75c2d9f

Browse files
miss-islingtonJamesParrottbrianschubertAA-Turner
authored
[3.14] pythongh-138297 Point link in docs for finally to try/else, instead of if/else (pythonGH-138298) (python#138381)
Co-authored-by: James Parrott <[email protected]> Co-authored-by: Brian Schubert <[email protected]> Co-authored-by: Adam Turner <[email protected]>
1 parent 769f7a5 commit 75c2d9f

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
@@ -416,12 +416,14 @@ clauses.
416416
--------------------------
417417

418418
If :keyword:`!finally` is present, it specifies a 'cleanup' handler. The
419-
:keyword:`try` clause is executed, including any :keyword:`except` and
420-
:keyword:`else` clauses. If an exception occurs in any of the clauses and is
421-
not handled, the exception is temporarily saved. The :keyword:`!finally` clause
422-
is executed. If there is a saved exception it is re-raised at the end of the
423-
:keyword:`!finally` clause. If the :keyword:`!finally` clause raises another
424-
exception, the saved exception is set as the context of the new exception.
419+
:keyword:`try` clause is executed, including any :keyword:`except`
420+
and :keyword:`else <except_else>` clauses.
421+
If an exception occurs in any of the clauses and is not handled,
422+
the exception is temporarily saved.
423+
The :keyword:`!finally` clause is executed. If there is a saved exception
424+
it is re-raised at the end of the :keyword:`!finally` clause.
425+
If the :keyword:`!finally` clause raises another exception, the saved exception
426+
is set as the context of the new exception.
425427
If the :keyword:`!finally` clause executes a :keyword:`return`, :keyword:`break`
426428
or :keyword:`continue` statement, the saved exception is discarded. For example,
427429
this function returns 42.

0 commit comments

Comments
 (0)