Completed the patch for Bug #215126.

* Fixes an incorrect variable in a PyDict_CheckExact.
* Allow general mapping locals arguments for the execfile() function
  and exec statement.
* Add tests.
This commit is contained in:
Raymond Hettinger 2004-08-02 08:30:07 +00:00
parent 32083f64a7
commit 66bd233225
5 changed files with 93 additions and 6 deletions

View file

@ -539,11 +539,15 @@ builtin_execfile(PyObject *self, PyObject *args)
PyCompilerFlags cf;
int exists;
if (!PyArg_ParseTuple(args, "s|O!O!:execfile",
if (!PyArg_ParseTuple(args, "s|O!O:execfile",
&filename,
&PyDict_Type, &globals,
&PyDict_Type, &locals))
&locals))
return NULL;
if (locals != Py_None && !PyMapping_Check(locals)) {
PyErr_SetString(PyExc_TypeError, "locals must be a mapping");
return NULL;
}
if (globals == Py_None) {
globals = PyEval_GetGlobals();
if (locals == Py_None)