[Python-checkins] cpython: WITH_CLEANUP_START uses fastcall
victor.stinner
python-checkins at python.org
Thu Dec 1 09:09:47 EST 2016
https://hg.python.org/cpython/rev/bcffa53f3453
changeset: 105403:bcffa53f3453
user: Victor Stinner <victor.stinner at gmail.com>
date: Thu Dec 01 14:45:31 2016 +0100
summary:
WITH_CLEANUP_START uses fastcall
Modify WITH_CLEANUP_START bytecode: replace PyObject_CallFunctionObjArgs() with
_PyObject_FastCall().
files:
Python/ceval.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3135,8 +3135,12 @@
gotos should still be resumed.)
*/
+ PyObject* stack[3];
PyObject *exit_func;
- PyObject *exc = TOP(), *val = Py_None, *tb = Py_None, *res;
+ PyObject *exc, *val, *tb, *res;
+
+ val = tb = Py_None;
+ exc = TOP();
if (exc == Py_None) {
(void)POP();
exit_func = TOP();
@@ -3180,8 +3184,11 @@
assert(block->b_type == EXCEPT_HANDLER);
block->b_level--;
}
- /* XXX Not the fastest way to call it... */
- res = PyObject_CallFunctionObjArgs(exit_func, exc, val, tb, NULL);
+
+ stack[0] = exc;
+ stack[1] = val;
+ stack[2] = tb;
+ res = _PyObject_FastCall(exit_func, stack, 3);
Py_DECREF(exit_func);
if (res == NULL)
goto error;
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list