Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8e2b6b5

Browse files
committed
Change documentation of 'else' clause of 'try/except' to make clear that it
doesn't get triggered by 'return', 'break' or 'continue'. If the 'try-inside-continue' patch does not get accepted before next release, the 'or continue' should be removed ;P Closes SF patch #103045 and SF bug #127098.
1 parent 9473649 commit 8e2b6b5

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

Doc/ref/ref7.tex

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,11 @@ \section{The \keyword{try} statement\label{try}}
242242
\withsubitem{(in module sys)}{\ttindex{exc_type}
243243
\ttindex{exc_value}\ttindex{exc_traceback}}
244244

245-
The optional \keyword{else} clause is executed when no exception occurs
246-
in the \keyword{try} clause. Exceptions in the \keyword{else} clause are
247-
not handled by the preceding \keyword{except} clauses.
245+
The optional \keyword{else} clause is executed when the \keyword{try} clause
246+
terminates by any means other than an exception or executing a
247+
\keyword{return}, \keyword{continue} or \keyword{break} statement.
248+
Exceptions in the \keyword{else} clause are not handled by the preceding
249+
\keyword{except} clauses.
248250
\kwindex{else}
249251

250252
The \keyword{try}...\keyword{finally} form specifies a `cleanup' handler. The

0 commit comments

Comments
 (0)