Author vstinner
Recipients vstinner
Date 2016-08-20.00:32:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1471653166.26.0.257085519078.issue27810@psf.upfronthosting.co.za>
In-reply-to
Content
The issue #27128 added _PyObject_FastCall() to avoid the creation of temporary tuples when calling 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)

Using METH_VARARGS, args is a Python tuple. Using METH_FASTCALL, args is a C array of PyObject*, and there is a second nargs parameter.

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).

This issue depends on the issue #27809 "_PyObject_FastCall(): add support for keyword arguments". I will wait until this dependency is implemented, before working on the implementation of this part.

For a full implementation, see my first attempt in the issue #26814. I will extract the code from this branch to write a new patch.
History
Date User Action Args
2016-08-20 00:32:46vstinnersetrecipients: + vstinner
2016-08-20 00:32:46vstinnersetmessageid: <1471653166.26.0.257085519078.issue27810@psf.upfronthosting.co.za>
2016-08-20 00:32:46vstinnerlinkissue27810 messages
2016-08-20 00:32:45vstinnercreate