summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-02-07 06:14:16 -0800
committerGitHub <noreply@github.com>2021-02-07 09:14:16 -0500
commit863eb7170b3017399fb2b786a1e3feb6457e54c2 (patch)
tree1e11ca1e43ab304dba3acf95a0db0062c4c5e307
parentSimple typo fix (GH-24448) (diff)
downloadcpython-863eb7170b3017399fb2b786a1e3feb6457e54c2.tar.gz
cpython-863eb7170b3017399fb2b786a1e3feb6457e54c2.tar.bz2
cpython-863eb7170b3017399fb2b786a1e3feb6457e54c2.zip
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. (cherry picked from commit 0ec57e25c918b859b9f8d464e34e0ac859c2f8b3) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
-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 9d13967c04f..990fc10c8cc 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -508,7 +508,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``.