[Python-checkins] cpython (3.5): Issue #24637: Document that locals can be any mapping object

berker.peksag python-checkins at python.org
Fri Aug 12 22:38:15 EDT 2016


https://hg.python.org/cpython/rev/0f2a09950ac8
changeset:   102627:0f2a09950ac8
branch:      3.5
parent:      102624:927c29e1d646
user:        Berker Peksag <berker.peksag at gmail.com>
date:        Sat Aug 13 05:37:49 2016 +0300
summary:
  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.

files:
  Doc/c-api/veryhigh.rst |  17 +++++++++--------
  1 files changed, 9 insertions(+), 8 deletions(-)


diff --git a/Doc/c-api/veryhigh.rst b/Doc/c-api/veryhigh.rst
--- a/Doc/c-api/veryhigh.rst
+++ b/Doc/c-api/veryhigh.rst
@@ -219,9 +219,10 @@
 .. 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
-   dictionaries *globals* and *locals* with the compiler flags specified by
-   *flags*.  The parameter *start* specifies the start token that should be used to
-   parse the source code.
+   objects *globals* and *locals* with the compiler flags specified by
+   *flags*.  *globals* must be a dictionary; *locals* can be any object
+   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
    exception was raised.
@@ -295,16 +296,16 @@
 .. c:function:: PyObject* PyEval_EvalCode(PyObject *co, PyObject *globals, PyObject *locals)
 
    This is a simplified interface to :c:func:`PyEval_EvalCodeEx`, with just
-   the code object, and the dictionaries of global and local variables.
-   The other arguments are set to *NULL*.
+   the code object, and global and local variables.  The other arguments are
+   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)
 
    Evaluate a precompiled code object, given a particular environment for its
-   evaluation.  This environment consists of dictionaries of global and local
-   variables, arrays of arguments, keywords and defaults, and a closure tuple of
-   cells.
+   evaluation.  This environment consists of a dictionary of global variables,
+   a mapping object of local variables, arrays of arguments, keywords and
+   defaults, and a closure tuple of cells.
 
 
 .. c:type:: PyFrameObject

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list