mirror of
https://github.com/python/cpython.git
synced 2025-09-15 21:26:04 +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
|
@ -1643,7 +1643,7 @@ PyEval_EvalFrame(PyFrameObject *f)
|
|||
w = GETITEM(names, oparg);
|
||||
v = POP();
|
||||
if ((x = f->f_locals) != NULL) {
|
||||
if (PyDict_CheckExact(v))
|
||||
if (PyDict_CheckExact(x))
|
||||
err = PyDict_SetItem(x, w, v);
|
||||
else
|
||||
err = PyObject_SetItem(x, w, v);
|
||||
|
@ -4116,9 +4116,9 @@ exec_statement(PyFrameObject *f, PyObject *prog, PyObject *globals,
|
|||
"exec: arg 2 must be a dictionary or None");
|
||||
return -1;
|
||||
}
|
||||
if (!PyDict_Check(locals)) {
|
||||
if (!PyMapping_Check(locals)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"exec: arg 3 must be a dictionary or None");
|
||||
"exec: arg 3 must be a mapping or None");
|
||||
return -1;
|
||||
}
|
||||
if (PyDict_GetItemString(globals, "__builtins__") == NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue