summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-09-30 06:32:59 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-09-30 06:32:59 (GMT)
commitaf5910f0259ae9667d23f7829de1298491704fee (patch)
treebd25b67e9f0314c406b906a471ae0bc605d2ce48
parent1c33daf14330ad1ecdef574dcb40f409777247fd (diff)
downloadcpython-af5910f0259ae9667d23f7829de1298491704fee.zip
cpython-af5910f0259ae9667d23f7829de1298491704fee.tar.gz
cpython-af5910f0259ae9667d23f7829de1298491704fee.tar.bz2
The execfile() docs imply it acts on locals same as exec. But in truth
it acts more like assigning to keys in locals(), i.e. modifications to function locals aren't reflected in the locals when execfile() returns.
-rw-r--r--Doc/lib/libfuncs.tex7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex
index 8eccc82..ec7ce86 100644
--- a/Doc/lib/libfuncs.tex
+++ b/Doc/lib/libfuncs.tex
@@ -257,6 +257,13 @@ class instances are callable if they have a \method{__call__()} method.
If both dictionaries are omitted, the expression is executed in the
environment where \function{execfile()} is called. The return value is
\code{None}.
+
+ \strong{Warning:} The default \var{locals} act as described for function
+ \function{locals()} below: modifications to the default \var{locals}
+ dictionary should not be attempted. Pass an explicit \var{locals}
+ dictionary if you need to see effects of the code on \var{locals} after
+ function \function{execfile()} returns. \function{execfile()} cannot
+ be used reliably to modify a function's locals.
\end{funcdesc}
\begin{funcdesc}{file}{filename\optional{, mode\optional{, bufsize}}}