mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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:
parent
28c63f7ffb
commit
41bb43a71e
7 changed files with 87 additions and 46 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue