From 6ac24323cb3c01496b9e9d29965bab5c7f792e6b Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 6 Feb 2021 23:03:48 -0500 Subject: [PATCH] Add nonlocal to yield and return. --- Doc/library/functions.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 55dd3f03f929c7..e36a1695c2ad58 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``.