Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 842cfff

Browse files
committed
WITH_CLEANUP_START uses fastcall
Modify WITH_CLEANUP_START bytecode: replace PyObject_CallFunctionObjArgs() with _PyObject_FastCall().
1 parent 27580c1 commit 842cfff

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

Python/ceval.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3135,8 +3135,12 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
31353135
gotos should still be resumed.)
31363136
*/
31373137

3138+
PyObject* stack[3];
31383139
PyObject *exit_func;
3139-
PyObject *exc = TOP(), *val = Py_None, *tb = Py_None, *res;
3140+
PyObject *exc, *val, *tb, *res;
3141+
3142+
val = tb = Py_None;
3143+
exc = TOP();
31403144
if (exc == Py_None) {
31413145
(void)POP();
31423146
exit_func = TOP();
@@ -3180,8 +3184,11 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
31803184
assert(block->b_type == EXCEPT_HANDLER);
31813185
block->b_level--;
31823186
}
3183-
/* XXX Not the fastest way to call it... */
3184-
res = PyObject_CallFunctionObjArgs(exit_func, exc, val, tb, NULL);
3187+
3188+
stack[0] = exc;
3189+
stack[1] = val;
3190+
stack[2] = tb;
3191+
res = _PyObject_FastCall(exit_func, stack, 3);
31853192
Py_DECREF(exit_func);
31863193
if (res == NULL)
31873194
goto error;

0 commit comments

Comments
 (0)