]> granicus.if.org Git - python/commitdiff
Issue #13557: Clarify effect of giving two different namespaces to exec or
authorTerry Jan Reedy <tjreedy@udel.edu>
Sun, 8 Jul 2012 21:35:26 +0000 (17:35 -0400)
committerTerry Jan Reedy <tjreedy@udel.edu>
Sun, 8 Jul 2012 21:35:26 +0000 (17:35 -0400)
execfile().

Doc/library/functions.rst
Doc/reference/simple_stmts.rst
Misc/NEWS

index 54baecf3948afd61ffd83dcebce0553d0566d210..a324e51317a2d307bf8f0b691f2e564a3dbbed04 100644 (file)
@@ -430,7 +430,10 @@ available.  They are listed here in alphabetical order.
    The arguments are a file name and two optional dictionaries.  The file is parsed
    and evaluated as a sequence of Python statements (similarly to a module) using
    the *globals* and *locals* dictionaries as global and local namespace. If
-   provided, *locals* can be any mapping object.
+   provided, *locals* can be any mapping object.  Remember that at module level,
+   globals and locals are the same dictionary. If two separate objects are
+   passed as *globals* and *locals*, the code will be executed as if it were
+   embedded in a class definition.
 
    .. versionchanged:: 2.4
       formerly *locals* was required to be a dictionary.
index 05b78a030ef2230d487d8a198f430904a4366ed4..ce22b67188bdfde4e2bd28b323a7ed6b3b1d7055 100644 (file)
@@ -993,6 +993,9 @@ current scope.  If only the first expression after :keyword:`in` is specified,
 it should be a dictionary, which will be used for both the global and the local
 variables.  If two expressions are given, they are used for the global and local
 variables, respectively. If provided, *locals* can be any mapping object.
+Remember that at module level, globals and locals are the same dictionary. If
+two separate objects are given as *globals* and *locals*, the code will be
+executed as if it were embedded in a class definition.
 
 .. versionchanged:: 2.4
    Formerly, *locals* was required to be a dictionary.
index c5e2e92737bbde2720f4b8ac78c1fa748bc8a5a6..52439fe50a5457343fc5c390ce14aad2a70ddc47 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -284,7 +284,9 @@ Build
 - Issue #14437: Fix building the _io module under Cygwin.
 
 Documentation
--------------
+
+- Issue #13557: Clarify effect of giving two different namespaces to exec or
+  execfile().
 
 - Issue #14034: added the argparse tutorial.