summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-10-29 00:19:37 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-10-29 00:19:37 (GMT)
commit41bb43a71e1caa4e6993c6571544d415c9e178b9 (patch)
tree7c6dd0407d1aff5ba9c4e6b4789bee09f95b3fc2 /Python/sysmodule.c
parent28c63f7ffb9f9cb59c524dc14ce66d34c0e83af6 (diff)
downloadcpython-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 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index d8848ae..97ce059 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)