Hi, I pushed the most basic implementation of _PyObject_FastCall(), it doesn't support keyword parameters yet: https://hg.python.org/cpython/rev/a1a29d20f52d https://bugs.python.org/issue27128
Then I patched a lot of call sites calling PyObject_Call(), PyObject_CallObject(), PyEval_CallObject(), etc. with a temporary tuple. Just one example: - args = PyTuple_Pack(1, match); - if (!args) { - Py_DECREF(match); - goto error; - } - item = PyObject_CallObject(filter, args); - Py_DECREF(args); + item = _PyObject_FastCall(filter, &match, 1, NULL); The next step is to support keyword parameters. In fact, it's already supported in all cases except of Python functions: https://bugs.python.org/issue27809 Supporting keyword parameters will allow to patch much code to avoid temporary tuples, but it is also required for a much more interesting change: https://bugs.python.org/issue27810 "Add METH_FASTCALL: new calling convention for C functions" I propose to add a new METH_FASTCALL calling convention. The example using METH_VARARGS | METH_KEYWORDS: PyObject* func(DirEntry *self, PyObject *args, PyObject *kwargs) becomes: PyObject* func(DirEntry *self, PyObject **args, int nargs, PyObject *kwargs) Later, Argument Clinic will be modified to *generate* code using the new METH_FASTCALL calling convention. Code written with Argument Clinic will only need to be updated by Argument Clinic to get the new faster calling convention (avoid the creation of a temporary tuple for positional arguments). Victor _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com