SF Bug #215126: Over restricted type checking on eval() function

The builtin eval() function now accepts any mapping for the locals argument.
Time sensitive steps guarded by PyDict_CheckExact() to keep from slowing
down the normal case.  My timings so no measurable impact.
This commit is contained in:
Raymond Hettinger 2004-07-02 06:41:07 +00:00
parent 78bace7442
commit 214b1c3aae
9 changed files with 103 additions and 31 deletions

View file

@ -291,8 +291,12 @@ class C:
\end{funcdesc}
\begin{funcdesc}{eval}{expression\optional{, globals\optional{, locals}}}
The arguments are a string and two optional dictionaries. The
\var{expression} argument is parsed and evaluated as a Python
The arguments are a string and optional globals and locals. If provided,
\var{globals} must be a dictionary. If provided, \var{locals} can be
any mapping object. \versionchanged[formerly \var{locals} was required
to be a dictionary]{2.4}
The \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{globals} dictionary is present and lacks