mirror of
https://github.com/python/cpython.git
synced 2025-10-21 06:02:21 +00:00
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:
parent
32083f64a7
commit
66bd233225
5 changed files with 93 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue