Mercurial > cpython-lru_cache-weakref
diff Python/sysmodule.c @ 86715:4ef4578db38a
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.
| author | Victor Stinner <victor.stinner@gmail.com> |
|---|---|
| date | Tue, 29 Oct 2013 01:19:37 +0100 |
| parents | 5eb00460e6e8 |
| children | a2f42d57b91d |
line wrap: on
line diff
--- a/Python/sysmodule.c Tue Oct 29 00:59:44 2013 +0100 +++ b/Python/sysmodule.c Tue Oct 29 01:19:37 2013 +0100 @@ -332,12 +332,16 @@ 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 @@ 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)
