[issue27809] _PyObject_FastCall(): add support for keyword arguments
STINNER Victor
report at bugs.python.org
Mon Aug 22 09:39:49 EDT 2016
STINNER Victor added the comment:
fastcall_macros.patch:
* Rename _PyObject_FastCall() to _PyObject_FastCallDict()
* Add _PyObject_FastCall(func, args, nargs) macro
* Add _PyObject_CallArg1(func, arg) macro
* Add _PyObject_CallNoArg(func) macro
The 3 new macros call _PyObject_FastCallDict().
Statistics on calls to these functions and macros:
* _PyObject_CallNoArg: 11
* _PyObject_CallArg1: 8
* _PyObject_FastCall: 5
* _PyObject_FastCallDict: 0 (the function doesn't work yet, it's the purpose of this issue, so it's expected that it's unused yet ;-))
_PyObject_CallNoArg() and _PyObject_CallArg1() are much more common and the more complex format _PyObject_FastCall() format (more than 1 argument). I like having macros with a simple prototype.
--
The C API has a wide choice of functions to call a function, but I still want to add _PyObject_CallNoArg() and _PyObject_CallArg1() to get the best performances (avoid layers before reaching the final _PyObject_FastCallDict) and have a simple and well defined prototype for the most common function calls.
kwargs:
* PyObject_Call(): root of all call functions in Python 3.5
* PyEval_CallObjectWithKeywords(func, args, kwargs) -> PyObject_Call()
args:
* PyEval_CallObject(func, args)
* PyObject_CallObject(func, args) -> PyEval_CallObjectWithKeywords()
vargs:
* PyObject_CallFunctionObjArgs(func, ...) -> PyObject_Call()
format:
* PyObject_CallFunction(func, format, ...) -> PyObject_Call()
* PyObject_CallMethod(func, method, format, ...) -> PyObject_Call()
* _PyObject_CallMethodId(func, method_id, format, ...) -> PyObject_Call()
* PyEval_CallFunction(func, format, ...) -> PyEval_CallObject()
* PyEval_CallMethod(func, method, format, ...) -> PyEval_CallObject()
Fast call:
* _PyObject_CallNoArg(func) -> _PyObject_FastCallDict()
* _PyObject_CallArg1(func, arg) -> _PyObject_FastCallDict()
* _PyObject_FastCall(func, arg) -> _PyObject_FastCallDict()
----------
Added file: http://bugs.python.org/file44188/fastcall_macros.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27809>
_______________________________________
More information about the Python-bugs-list
mailing list