diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-10-29 01:19:37 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-10-29 01:19:37 +0100 |
commit | 41bb43a71e1caa4e6993c6571544d415c9e178b9 (patch) | |
tree | 7c6dd0407d1aff5ba9c4e6b4789bee09f95b3fc2 /Python/sysmodule.c | |
parent | 28c63f7ffb9f9cb59c524dc14ce66d34c0e83af6 (diff) | |
download | cpython-git-41bb43a71e1caa4e6993c6571544d415c9e178b9.tar.gz |
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 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index d8848ae977..97ce0594b5 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -332,12 +332,16 @@ static PyObject * call_trampoline(PyThreadState *tstate, PyObject* callback, PyFrameObject *frame, int what, PyObject *arg) { - PyObject *args = PyTuple_New(3); + PyObject *args; PyObject *whatstr; PyObject *result; + args = PyTuple_New(3); if (args == NULL) return NULL; + if (PyFrame_FastToLocalsWithError(frame) < 0) + return NULL; + Py_INCREF(frame); whatstr = whatstrings[what]; Py_INCREF(whatstr); @@ -349,7 +353,6 @@ call_trampoline(PyThreadState *tstate, PyObject* callback, PyTuple_SET_ITEM(args, 2, arg); /* call the Python-level function */ - PyFrame_FastToLocals(frame); result = PyEval_CallObject(callback, args); PyFrame_LocalsToFast(frame, 1); if (result == NULL) |