Issue #18408: Add a new PyFrame_FastToLocalsWithError() function to handle

exceptions when merging fast locals into f_locals of a frame.
PyEval_GetLocals() now raises an exception and return NULL on failure.
This commit is contained in:
Victor Stinner 2013-10-29 01:19:37 +01:00
parent 28c63f7ffb
commit 41bb43a71e
7 changed files with 87 additions and 46 deletions

View file

@ -1407,12 +1407,11 @@ static PyObject *
_dir_locals(void)
{
PyObject *names;
PyObject *locals = PyEval_GetLocals();
PyObject *locals;
if (locals == NULL) {
PyErr_SetString(PyExc_SystemError, "frame does not exist");
locals = PyEval_GetLocals();
if (locals == NULL)
return NULL;
}
names = PyMapping_Keys(locals);
if (!names)