Commit bd664357 authored by Berker Peksag's avatar Berker Peksag

Issue #24637: Document that locals can be any mapping object

This behavior is already tested in test_general_eval in
Lib/test/test_builtin.py

Patch by Matthew Keeter.
parent 6336fb27
...@@ -219,9 +219,10 @@ the same library that the Python runtime is using. ...@@ -219,9 +219,10 @@ the same library that the Python runtime is using.
.. c:function:: PyObject* PyRun_StringFlags(const char *str, int start, PyObject *globals, PyObject *locals, PyCompilerFlags *flags) .. c:function:: PyObject* PyRun_StringFlags(const char *str, int start, PyObject *globals, PyObject *locals, PyCompilerFlags *flags)
Execute Python source code from *str* in the context specified by the Execute Python source code from *str* in the context specified by the
dictionaries *globals* and *locals* with the compiler flags specified by objects *globals* and *locals* with the compiler flags specified by
*flags*. The parameter *start* specifies the start token that should be used to *flags*. *globals* must be a dictionary; *locals* can be any object
parse the source code. that implements the mapping protocol. The parameter *start* specifies
the start token that should be used to parse the source code.
Returns the result of executing the code as a Python object, or *NULL* if an Returns the result of executing the code as a Python object, or *NULL* if an
exception was raised. exception was raised.
...@@ -295,16 +296,16 @@ the same library that the Python runtime is using. ...@@ -295,16 +296,16 @@ the same library that the Python runtime is using.
.. c:function:: PyObject* PyEval_EvalCode(PyObject *co, PyObject *globals, PyObject *locals) .. c:function:: PyObject* PyEval_EvalCode(PyObject *co, PyObject *globals, PyObject *locals)
This is a simplified interface to :c:func:`PyEval_EvalCodeEx`, with just This is a simplified interface to :c:func:`PyEval_EvalCodeEx`, with just
the code object, and the dictionaries of global and local variables. the code object, and global and local variables. The other arguments are
The other arguments are set to *NULL*. set to *NULL*.
.. c:function:: PyObject* PyEval_EvalCodeEx(PyObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argcount, PyObject **kws, int kwcount, PyObject **defs, int defcount, PyObject *closure) .. c:function:: PyObject* PyEval_EvalCodeEx(PyObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argcount, PyObject **kws, int kwcount, PyObject **defs, int defcount, PyObject *closure)
Evaluate a precompiled code object, given a particular environment for its Evaluate a precompiled code object, given a particular environment for its
evaluation. This environment consists of dictionaries of global and local evaluation. This environment consists of a dictionary of global variables,
variables, arrays of arguments, keywords and defaults, and a closure tuple of a mapping object of local variables, arrays of arguments, keywords and
cells. defaults, and a closure tuple of cells.
.. c:type:: PyFrameObject .. c:type:: PyFrameObject
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment