diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-09-01 23:06:35 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-09-01 23:06:35 (GMT) |
commit | b44c8619fed78642ff5bd786f3a0b4427ea3a10a (patch) | |
tree | 5b9dbb4e313ef16343d73df706052bf2efb55440 /Doc/reference | |
parent | 71b2ded05e55a044cbba9257ed43ed34b5e9648c (diff) | |
download | cpython-b44c8619fed78642ff5bd786f3a0b4427ea3a10a.zip cpython-b44c8619fed78642ff5bd786f3a0b4427ea3a10a.tar.gz cpython-b44c8619fed78642ff5bd786f3a0b4427ea3a10a.tar.bz2 |
document that various functions that parse from source will interpret things as latin-1 (closes #18870)
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/simple_stmts.rst | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst index a6fd064..254d1ba 100644 --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -981,15 +981,16 @@ The :keyword:`exec` statement exec_stmt: "exec" `or_expr` ["in" `expression` ["," `expression`]] This statement supports dynamic execution of Python code. The first expression -should evaluate to either a string, an open file object, a code object, or a -tuple. If it is a string, the string is parsed as a suite of Python statements -which is then executed (unless a syntax error occurs). [#]_ If it is an open -file, the file is parsed until EOF and executed. If it is a code object, it is -simply executed. For the interpretation of a tuple, see below. In all cases, -the code that's executed is expected to be valid as file input (see section -:ref:`file-input`). Be aware that the :keyword:`return` and :keyword:`yield` -statements may not be used outside of function definitions even within the -context of code passed to the :keyword:`exec` statement. +should evaluate to either a Unicode string, a *Latin-1* encoded string, an open +file object, a code object, or a tuple. If it is a string, the string is parsed +as a suite of Python statements which is then executed (unless a syntax error +occurs). [#]_ If it is an open file, the file is parsed until EOF and executed. +If it is a code object, it is simply executed. For the interpretation of a +tuple, see below. In all cases, the code that's executed is expected to be +valid as file input (see section :ref:`file-input`). Be aware that the +:keyword:`return` and :keyword:`yield` statements may not be used outside of +function definitions even within the context of code passed to the +:keyword:`exec` statement. In all cases, if the optional parts are omitted, the code is executed in the current scope. If only the first expression after ``in`` is specified, |