diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-08-19 23:22:57 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-08-19 23:22:57 (GMT) |
commit | 78da82bf3eec2745b32b89ba5850a6f1268dd8aa (patch) | |
tree | 1a93e73afd6f3dc0bb37b1e0e8f0a27c8abd2347 /Python | |
parent | 71cb64acc27723fa4d648374d084a07030ab10fb (diff) | |
download | cpython-78da82bf3eec2745b32b89ba5850a6f1268dd8aa.zip cpython-78da82bf3eec2745b32b89ba5850a6f1268dd8aa.tar.gz cpython-78da82bf3eec2745b32b89ba5850a6f1268dd8aa.tar.bz2 |
call_trampoline() now uses fast call
Issue #27128.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/sysmodule.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 56175d9..74b8560 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -368,34 +368,25 @@ static PyObject * call_trampoline(PyObject* callback, PyFrameObject *frame, int what, PyObject *arg) { - PyObject *args; - PyObject *whatstr; PyObject *result; + PyObject *stack[3]; - args = PyTuple_New(3); - if (args == NULL) - return NULL; - if (PyFrame_FastToLocalsWithError(frame) < 0) + if (PyFrame_FastToLocalsWithError(frame) < 0) { return NULL; + } - Py_INCREF(frame); - whatstr = whatstrings[what]; - Py_INCREF(whatstr); - 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); + stack[0] = (PyObject *)frame; + stack[1] = whatstrings[what]; + stack[2] = (arg != NULL) ? arg : Py_None; /* call the Python-level function */ - result = PyEval_CallObject(callback, args); + result = _PyObject_FastCall(callback, stack, 3, NULL); + PyFrame_LocalsToFast(frame, 1); - if (result == NULL) + if (result == NULL) { PyTraceBack_Here(frame); + } - /* cleanup */ - Py_DECREF(args); return result; } |