mirror of
https://github.com/python/cpython.git
synced 2025-08-23 02:04:56 +00:00
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.
This commit is contained in:
parent
28c63f7ffb
commit
41bb43a71e
7 changed files with 87 additions and 46 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue