[Python-checkins] bpo-16781: In 'exec' doc, add 'nonlocal' to 'yield' and 'return' (GH-2446)

terryjreedy webhook-mailer at python.org
Sun Feb 7 00:29:07 EST 2021


https://github.com/python/cpython/commit/0ec57e25c918b859b9f8d464e34e0ac859c2f8b3
commit: 0ec57e25c918b859b9f8d464e34e0ac859c2f8b3
branch: master
author: Terry Jan Reedy <tjreedy at udel.edu>
committer: terryjreedy <tjreedy at udel.edu>
date: 2021-02-07T00:28:50-05:00
summary:

bpo-16781: In 'exec' doc, add 'nonlocal' to 'yield' and 'return' (GH-2446)

These 3 statements cannot be used at module scope -- nor in exec with one namespace.

files:
M Doc/library/functions.rst

diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 55dd3f03f929c..e36a1695c2ad5 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -526,7 +526,8 @@ are always available.  They are listed here in alphabetical order.
    occurs). [#]_ If it is a code object, it is simply executed.  In all cases,
    the code that's executed is expected to be valid as file input (see the
    section "File input" in the Reference Manual). Be aware that the
-   :keyword:`return` and :keyword:`yield` statements may not be used outside of
+   :keyword:`nonlocal`, :keyword:`yield`,  and :keyword:`return`
+   statements may not be used outside of
    function definitions even within the context of code passed to the
    :func:`exec` function. The return value is ``None``.
 



More information about the Python-checkins mailing list