bpo-16781: In 'exec' doc, add 'nonlocal' to 'yield' and 'return' (GH-… · python/cpython@0ec57e2 (original) (raw)

Original file line number Diff line number Diff line change
@@ -526,7 +526,8 @@ are always available. They are listed here in alphabetical order.
526 526 occurs). [#]_ If it is a code object, it is simply executed. In all cases,
527 527 the code that's executed is expected to be valid as file input (see the
528 528 section "File input" in the Reference Manual). Be aware that the
529 -:keyword:`return` and :keyword:`yield` statements may not be used outside of
529 +:keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return`
530 + statements may not be used outside of
530 531 function definitions even within the context of code passed to the
531 532 :func:`exec` function. The return value is ``None``.
532 533