[Python-checkins] cpython (3.2): Issue #13557: Clarify effect of giving two different namespaces to exec or

terry.reedy python-checkins at python.org
Sun Jul 8 23:53:53 CEST 2012


http://hg.python.org/cpython/rev/ea670d71a36d
changeset:   78012:ea670d71a36d
branch:      3.2
parent:      77992:ee1828dc3bf6
user:        Terry Jan Reedy <tjreedy at udel.edu>
date:        Sun Jul 08 17:36:14 2012 -0400
summary:
  Issue #13557: Clarify effect of giving two different namespaces to exec or
execfile().

files:
  Doc/library/functions.rst |  5 ++++-
  Misc/NEWS                 |  6 +++---
  2 files changed, 7 insertions(+), 4 deletions(-)


diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -417,7 +417,10 @@
    current scope.  If only *globals* is provided, it must be a dictionary, which
    will be used for both the global and the local variables.  If *globals* and
    *locals* are given, they are used for the global and local variables,
-   respectively.  If provided, *locals* can be any mapping object.
+   respectively.  If provided, *locals* can be any mapping object.  Remember
+   that at module level, globals and locals are the same dictionary. If exec
+   gets two separate objects as *globals* and *locals*, the code will be
+   executed as if it were embedded in a class definition.
 
    If the *globals* dictionary does not contain a value for the key
    ``__builtins__``, a reference to the dictionary of the built-in module
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -380,14 +380,14 @@
 Documentation
 -------------
 
+- Issue #13557: Clarify effect of giving two different namespaces to exec or
+  execfile().
+
 - Issue #8799: Fix and improve the threading.Condition documentation.
 
 - Issue #14943: Correct a default argument value for winreg.OpenKey
   and correctly list the argument names in the function's explanation.
 
-Documentation
--------------
-
 - Issue #14034: added the argparse tutorial.
 
 Tools/Demos

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


More information about the Python-checkins mailing list