diff options
author | Raymond Hettinger <python@rcn.com> | 2004-08-02 08:30:07 +0000 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-08-02 08:30:07 +0000 |
commit | 66bd23322567a9ef0ad7bbe2436fef73b18bc9db (patch) | |
tree | 42b92af0e05cd7778f47a2e905dc559eaf50caca /Python/bltinmodule.c | |
parent | 32083f64a71c4ac80830231479914e40cbd8488b (diff) | |
download | cpython-git-66bd23322567a9ef0ad7bbe2436fef73b18bc9db.tar.gz |
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.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 4143681b8a..b76f3739fa 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -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) |