mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
* Fix missing return after error message is set.
* Add a test case that would have caught it.
This commit is contained in:
parent
2f55eb4cca
commit
513ffe8112
2 changed files with 3 additions and 1 deletions
|
@ -459,12 +459,13 @@ builtin_eval(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
if (locals != Py_None && !PyMapping_Check(locals)) {
|
||||
PyErr_SetString(PyExc_TypeError, "locals must be a mapping");
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
if (globals != Py_None && !PyDict_Check(globals)) {
|
||||
PyErr_SetString(PyExc_TypeError, PyMapping_Check(globals) ?
|
||||
"globals must be a real dict; try eval(expr, {}, mapping)"
|
||||
: "globals must be a dict");
|
||||
return NULL;
|
||||
}
|
||||
if (globals == Py_None) {
|
||||
globals = PyEval_GetGlobals();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue