Hi,

I already mentioned this possibility a couple of times on this list, but
now the idea has attracted some more general interest.

The Cython project would like to specify a general way of unpacking wrapped
native functions for Python implementations. This is interesting for
CPython because it would allow NumPy and other extensions to unpack
functions implemented by other extensions before calling them in loops.
PyPy could let its JIT do the same at runtime.

Cython and low-level wrapper generators would be the obvious way to
implement this, but it would also provide a generic way for Cython to
unpack a function pointer from wrapped functions exported by other modules,
at least if the native signature is known (or likely to be known) at
compile time.

Dag Seljebotn has started writing a CEP (Cython Enhancement Proposal) about
it and opened the discussion on the Cython core developers mailing list.

http://wiki.cython.org/enhancements/cep1000

http://thread.gmane.org/gmane.comp.python.cython.devel/13416/focus=13417

http://mail.python.org/mailman/listinfo/cython-devel


Additionally, there is PEP 362 which aims to provide a Signature object for
Python functions. I think we should build native signatures on top of that.

http://www.python.org/dev/peps/pep-0362/

Note that a wrapper function may offer more than one native signature, e.g.
when wrapping overloaded C++ functions or when using Cython fused functions.

We may eventually end up with a PEP instead of a CEP for this, but I think
it's still some way before we get there. Please participate in the
discussion if you are interested.

Stefan

_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to