summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2021-02-07 05:28:50 (GMT)
committerGitHub <noreply@github.com>2021-02-07 05:28:50 (GMT)
commit0ec57e25c918b859b9f8d464e34e0ac859c2f8b3 (patch)
tree38841883fef7dbb9a46d0d115a4d84a881411bfa
parent5f18c223391eef8c7d01241b51a7b2429609dd84 (diff)
downloadcpython-0ec57e25c918b859b9f8d464e34e0ac859c2f8b3.zip
cpython-0ec57e25c918b859b9f8d464e34e0ac859c2f8b3.tar.gz
cpython-0ec57e25c918b859b9f8d464e34e0ac859c2f8b3.tar.bz2
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.
-rw-r--r--Doc/library/functions.rst3
1 files changed, 2 insertions, 1 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 55dd3f0..e36a169 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``.