STINNER Victor added the comment:

> Maybe a new C function can be designed to call a function: it would uses 
> PyEval_EvalCodeEx() to call functions implemented in Python, or create the 
> tuple for functions implemented in C.

I would expect C code to be more optimized that Python functions, but for the 
specific case of function calls: Python are more optimized with the fast-path 
fast_function()!

I recall vaguely that Larry Hasting shared me his idea of passing the Python 
stack to C functions to avoid the creation of a tuple.

Maybe we can add a new API for C functions accepted a C array of PyObject*, a 
number of positional arguments and a number of (key, value) pairs for keyword 
arguments. Something similar to PyEval_EvalCodeEx() but for C functions. It 
means that we should add a new flavor of 
PyArg_ParseTuple/PyArg_ParseTupleAndKeywords to accepts this format.

Larry's idea was to use the argument clinic to handle that for us.

----------
nosy: +larry

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26811>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to