summaryrefslogtreecommitdiff
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-10-29 01:19:37 +0100
committerVictor Stinner <victor.stinner@gmail.com>2013-10-29 01:19:37 +0100
commitac1d52868507eab11a080e7600005366a5e1be26 (patch)
tree36af8f436c9d569c5a6bafb7c2b41e21292d74e2 /Python/sysmodule.c
parentec75521d3d382167867218c9667999d6c96feb8a (diff)
downloadcpython-ac1d52868507eab11a080e7600005366a5e1be26.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.c7
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)