diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2007-08-12 00:43:29 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2007-08-12 00:43:29 (GMT) |
commit | 016880229a369a3fb419f3eed28b6db7c342fe71 (patch) | |
tree | 9b11de5c197bc556dd515e035327673765cd4871 /Doc/lib | |
parent | 41eaedd3613cebc83e6b9925499369992c7a7770 (diff) | |
download | cpython-016880229a369a3fb419f3eed28b6db7c342fe71.zip cpython-016880229a369a3fb419f3eed28b6db7c342fe71.tar.gz cpython-016880229a369a3fb419f3eed28b6db7c342fe71.tar.bz2 |
Kill execfile(), use exec() instead
Diffstat (limited to 'Doc/lib')
-rw-r--r-- | Doc/lib/libdoctest.tex | 2 | ||||
-rw-r--r-- | Doc/lib/libexcs.tex | 2 | ||||
-rw-r--r-- | Doc/lib/libfuncs.tex | 31 | ||||
-rw-r--r-- | Doc/lib/libuser.tex | 2 |
4 files changed, 5 insertions, 32 deletions
diff --git a/Doc/lib/libdoctest.tex b/Doc/lib/libdoctest.tex index 5e28c2a..9143b84 100644 --- a/Doc/lib/libdoctest.tex +++ b/Doc/lib/libdoctest.tex @@ -1828,7 +1828,7 @@ print doctest.testsource(a, "a.f") via \function{\refmodule{pdb}.post_mortem()}, passing the traceback object from the unhandled exception. If \var{pm} is not specified, or is false, the script is run under the debugger from the start, via passing an - appropriate \function{execfile()} call to \function{\refmodule{pdb}.run()}. + appropriate \function{exec()} call to \function{\refmodule{pdb}.run()}. \versionadded{2.3} diff --git a/Doc/lib/libexcs.tex b/Doc/lib/libexcs.tex index 298f04d..74531d3 100644 --- a/Doc/lib/libexcs.tex +++ b/Doc/lib/libexcs.tex @@ -260,7 +260,7 @@ Raised when an \keyword{assert} statement fails. % XXXJH xref to these functions? Raised when the parser encounters a syntax error. This may occur in an \keyword{import} statement, in a call to the built-in functions - \function{exec()}, \function{execfile()}, \function{eval()} or + \function{exec()}, \function{eval()} or \function{input()}, or when reading the initial script or standard input (also interactively). diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index 3cc06c8..0b99c3f 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -382,15 +382,13 @@ class C: compiled passing \code{'eval'} as the \var{kind} argument. Hints: dynamic execution of statements is supported by the - \function{exec()} function. Execution of statements from a file is - supported by the \function{execfile()} function. The + \function{exec()} function. The \function{globals()} and \function{locals()} functions returns the current global and local dictionary, respectively, which may be useful to pass around for use by \function{eval()} or - \function{execfile()}. + \function{exec()}. \end{funcdesc} - \begin{funcdesc}{exec}{object\optional{, globals\optional{, locals}}} This function supports dynamic execution of Python code. \var{object} must be either a string, an open file object, or @@ -425,31 +423,6 @@ class C: argument to \function{exec()}.} \end{funcdesc} -\begin{funcdesc}{execfile}{filename\optional{, globals\optional{, locals}}} - This function is similar to the \function{exec()} function, but parses a - file given by the file name instead of a string. It - is different from the \keyword{import} statement in that it does not - use the module administration --- it reads the file unconditionally - and does not create a new module. - - 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 \var{globals} and \var{locals} dictionaries as global and - local namespace. If provided, \var{locals} can be any mapping object. - \versionchanged[formerly \var{locals} was required to be a dictionary]{2.4} - If the \var{locals} dictionary is omitted it defaults to the \var{globals} - dictionary. If both dictionaries are omitted, the expression is executed in - the environment where \function{execfile()} is called. The return value is - \code{None}. - - \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}}} Constructor function for the \class{file} type, described further in section~\ref{bltin-file-objects}, ``\ulink{File diff --git a/Doc/lib/libuser.tex b/Doc/lib/libuser.tex index 4e915a2..6dd1546 100644 --- a/Doc/lib/libuser.tex +++ b/Doc/lib/libuser.tex @@ -24,7 +24,7 @@ import user The \module{user} module looks for a file \file{.pythonrc.py} in the user's home directory and if it can be opened, executes it (using -\function{execfile()}\bifuncindex{execfile}) in its own (the +\function{exec()}\bifuncindex{exec}) in its own (the module \module{user}'s) global namespace. Errors during this phase are not caught; that's up to the program that imports the \module{user} module, if it wishes. The home directory is assumed to |