[Cython] CEP1000: Native dispatch through callables

Stefan Behnel stefan_ml at behnel.de
Fri Apr 13 21:50:15 CEST 2012

Robert Bradshaw, 13.04.2012 21:26:
> On Fri, Apr 13, 2012 at 12:15 PM, Stefan Behnel wrote:
>> Stefan Behnel, 13.04.2012 07:24:
>>> Dag Sverre Seljebotn, 13.04.2012 00:34:
>>>> On 04/13/2012 12:11 AM, Dag Sverre Seljebotn wrote:
>>>> http://wiki.cython.org/enhancements/cep1000
>>> I'm all for doing something in this direction and have been hinting at it
>>> on the PyPy mailing list for a while, without reaction so far. I'll trigger
>>> them again, with a pointer to this discussion and the CEP. PyPy should be
>>> totally interested in a generic way to do fast calls into wrapped C code in
>>> general and Cython implemented functions specifically. Their JIT would then
>>> look at the function at runtime and unwrap it.
>> I just learned that the support in PyPy would be rather straight forward.
>> It already supports calling native code with a known signature through
>> their "rlib/libffi.py" module,
> Cool.
>> so all that remains to be done on their side
>> is mapping the encoded signature to their own signature configuration.
> Or looking into borrowing theirs? (We might want more extensibility,
> e.g. declaring buffer types and nogil/exception data. I assume ctypes
> has a signature declaration format as well, right?)

PyPy's ctypes implementation is based on libffi. However, I think neither
of the two has a declaration format (e.g. string based) other than the
object based declaration notation. You basically pass them a sequence of
type objects to declare the signature. That's not really easy to map to the
C level - at least not efficiently...


More information about the cython-devel mailing list