From 4b0c62e02246e889729edc034a475b96707d487c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Delfino?= Date: Sun, 11 Nov 2018 16:33:51 -0300 Subject: [PATCH 1/2] [2.7] bpo-33699: Describe try's else clause with the rest of the try clause (GH-7252) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://bugs.python.org/issue33699. (cherry picked from commit b086c8afdb8c862011e3e27d4c8f6833749f2c56) Co-authored-by: Andrés Delfino --- Doc/reference/compound_stmts.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst index 92ce3cdeedcac0..b8e274fd2099f1 100644 --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -281,9 +281,11 @@ function that handled an exception. statement: break statement: continue -The optional :keyword:`else` clause is executed if and when control flows off -the end of the :keyword:`try` clause. [#]_ Exceptions in the :keyword:`else` -clause are not handled by the preceding :keyword:`except` clauses. +The optional :keyword:`else` clause is executed if the control flow leaves the +:keyword:`try` suite, no exception was raised, and no :keyword:`return`, +:keyword:`continue`, or :keyword:`break` statement was executed. Exceptions in +the :keyword:`else` clause are not handled by the preceding :keyword:`except` +clauses. .. index:: keyword: finally From 3c1ab56ff1fb4c580a2159783497435c41e3a585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Delfino?= Date: Sun, 11 Nov 2018 16:51:01 -0300 Subject: [PATCH 2/2] Forgot to remove old reference --- Doc/reference/compound_stmts.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst index b8e274fd2099f1..523d9b59f7138b 100644 --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -598,10 +598,6 @@ which is then bound to the class name. there is a :keyword:`finally` clause which happens to raise another exception. That new exception causes the old one to be lost. -.. [#] Currently, control "flows off the end" except in the case of an exception or the - execution of a :keyword:`return`, :keyword:`continue`, or :keyword:`break` - statement. - .. [#] A string literal appearing as the first statement in the function body is transformed into the function's ``__doc__`` attribute and therefore the function's :term:`docstring`.