diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-10-29 00:19:37 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-10-29 00:19:37 (GMT) |
commit | 41bb43a71e1caa4e6993c6571544d415c9e178b9 (patch) | |
tree | 7c6dd0407d1aff5ba9c4e6b4789bee09f95b3fc2 /Objects/object.c | |
parent | 28c63f7ffb9f9cb59c524dc14ce66d34c0e83af6 (diff) | |
download | cpython-41bb43a71e1caa4e6993c6571544d415c9e178b9.zip cpython-41bb43a71e1caa4e6993c6571544d415c9e178b9.tar.gz cpython-41bb43a71e1caa4e6993c6571544d415c9e178b9.tar.bz2 |
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.
Diffstat (limited to 'Objects/object.c')
-rw-r--r-- | Objects/object.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Objects/object.c b/Objects/object.c index 8018c6a..95a5334 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -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) |