mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
parent
71cb64acc2
commit
78da82bf3e
1 changed files with 12 additions and 21 deletions
|
@ -368,34 +368,25 @@ static PyObject *
|
||||||
call_trampoline(PyObject* callback,
|
call_trampoline(PyObject* callback,
|
||||||
PyFrameObject *frame, int what, PyObject *arg)
|
PyFrameObject *frame, int what, PyObject *arg)
|
||||||
{
|
{
|
||||||
PyObject *args;
|
|
||||||
PyObject *whatstr;
|
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
PyObject *stack[3];
|
||||||
|
|
||||||
args = PyTuple_New(3);
|
if (PyFrame_FastToLocalsWithError(frame) < 0) {
|
||||||
if (args == NULL)
|
|
||||||
return NULL;
|
|
||||||
if (PyFrame_FastToLocalsWithError(frame) < 0)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
Py_INCREF(frame);
|
stack[0] = (PyObject *)frame;
|
||||||
whatstr = whatstrings[what];
|
stack[1] = whatstrings[what];
|
||||||
Py_INCREF(whatstr);
|
stack[2] = (arg != NULL) ? arg : Py_None;
|
||||||
if (arg == NULL)
|
|
||||||
arg = Py_None;
|
|
||||||
Py_INCREF(arg);
|
|
||||||
PyTuple_SET_ITEM(args, 0, (PyObject *)frame);
|
|
||||||
PyTuple_SET_ITEM(args, 1, whatstr);
|
|
||||||
PyTuple_SET_ITEM(args, 2, arg);
|
|
||||||
|
|
||||||
/* call the Python-level function */
|
/* call the Python-level function */
|
||||||
result = PyEval_CallObject(callback, args);
|
result = _PyObject_FastCall(callback, stack, 3, NULL);
|
||||||
PyFrame_LocalsToFast(frame, 1);
|
|
||||||
if (result == NULL)
|
PyFrame_LocalsToFast(frame, 1);
|
||||||
PyTraceBack_Here(frame);
|
if (result == NULL) {
|
||||||
|
PyTraceBack_Here(frame);
|
||||||
|
}
|
||||||
|
|
||||||
/* cleanup */
|
|
||||||
Py_DECREF(args);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue