diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-02-07 05:38:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-07 05:38:54 (GMT) |
commit | 920bf6a3a656e329c2bcbb761eb8c13c46c8cd05 (patch) | |
tree | b7e1a44bb35bdb12d99c08c3981c9ee67767f04b /Doc/library/functions.rst | |
parent | b4796875d598b34f5f21cb13a8d3551574532595 (diff) | |
download | cpython-920bf6a3a656e329c2bcbb761eb8c13c46c8cd05.zip cpython-920bf6a3a656e329c2bcbb761eb8c13c46c8cd05.tar.gz cpython-920bf6a3a656e329c2bcbb761eb8c13c46c8cd05.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.
(cherry picked from commit 0ec57e25c918b859b9f8d464e34e0ac859c2f8b3)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Doc/library/functions.rst')
-rw-r--r-- | Doc/library/functions.rst | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 5a039f7..9d67d80 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -509,7 +509,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``. |