diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2002-12-17 01:08:06 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2002-12-17 01:08:06 (GMT) |
commit | 046b8a7244b9d5fe1ff7ea4557a321df5dc46e77 (patch) | |
tree | 24e1dbbaed430a92446269476647dd692254a29d /Doc/lib/libfuncs.tex | |
parent | e9ce25e512d455ae263600b67daef665a4ad13b5 (diff) | |
download | cpython-046b8a7244b9d5fe1ff7ea4557a321df5dc46e77.zip cpython-046b8a7244b9d5fe1ff7ea4557a321df5dc46e77.tar.gz cpython-046b8a7244b9d5fe1ff7ea4557a321df5dc46e77.tar.bz2 |
Fix SF # 641111, Undocumented side effect of eval
Try to clear up confusion about the current globals being copied
into a globals dict passed to eval(). This wording (more or less)
was suggested in bug report. It should probably be made clearer.
Backport candidate.
Diffstat (limited to 'Doc/lib/libfuncs.tex')
-rw-r--r-- | Doc/lib/libfuncs.tex | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index d29155d..ea48539 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -314,7 +314,12 @@ class C: \var{expression} argument is parsed and evaluated as a Python expression (technically speaking, a condition list) using the \var{globals} and \var{locals} dictionaries as global and local name - space. If the \var{locals} dictionary is omitted it defaults to + space. If the \var{globals} dictionary is present and lacks + '__builtins__', the current globals are copied into \var{globals} before + \var{expression} is parsed. This means that \var{expression} + normally has full access to the standard + \refmodule[builtin]{__builtin__} module and restricted environments + are propagated. 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 \keyword{eval} is called. The return value is the result of the evaluated expression. |