Message273408
In the issue #27809, I added support for keyword arguments to the function _PyObject_FastCallDict() (previously called _PyObject_FastCall). Keyword arguments are passed as a Python dictionary (dict).
_PyObject_FastCallDict() is efficient when keyword arguments are not used. But when keyword arguments are used, the creation of a temporary dictionary to pass keyword arguments can defeat the "fastcall" optimization for positional arguments.
See Serhiy Storchaka's comment:
http://bugs.python.org/issue27809#msg273367
Extract: "It may be more efficient to push values and names as continuous arrays (issue27213). PyArg_ParseTupleAndKeywords() accepts a tuple and a dict, but private function _PyArg_ParseTupleAndKeywordsFast() (issue27574) can be changed to accept positional and keyword arguments as continuous arrays: (int nargs, PyObject **args, int nkwargs, PyObject **kwnames, PyObject **kwargs)."
And Stefan Behnel's comment:
http://bugs.python.org/issue27809#msg273391
Serhiy proposed to pass keyword arguments as (key, value) pairs in C array. We can probably use the simple "stack" format used in Python/ceval.c:
PyObject* _PyObject_FastCallKeywords(PyObject *func, PyObject **stack, int nargs, int nkwargs)
where nargs is number of positional arguments at the beginning of stack, and nkwargs is the number of (key, value) pairs at the end of stack.
This function would be the fundation for a new C calling convention: METH_FASTCALL, see the issue #27810. |
|
Date |
User |
Action |
Args |
2016-08-22 22:44:24 | vstinner | set | recipients:
+ vstinner, scoder, serhiy.storchaka |
2016-08-22 22:44:24 | vstinner | set | messageid: <1471905864.17.0.99232719056.issue27830@psf.upfronthosting.co.za> |
2016-08-22 22:44:24 | vstinner | link | issue27830 messages |
2016-08-22 22:44:24 | vstinner | create | |
|