On 13 February 2012 23:04, Antonio Cuni <anto.c...@gmail.com> wrote:
> On 02/13/2012 11:26 PM, Stefan Behnel wrote:
>>>
>>> >  Last time I looked, Cython still generates code that PyPy cannot
>>> > handle:
>>> >  for example, it explicitly messes with tstate->curexc_type&co,
>>> >  Couldn't PyErr_Fetch() and PyErr_Restore() be used instead?
>>
>> Just two general comments on this, because these internals are really
>> off-topic for this list and much better suited for the cython-dev list.
>>
>> 1) These things are usually done for two reasons: sometimes for better
>> performance (inlining!), but also because there are cases where CPython
>> fails to match its own Python-level semantics at the C-API level (simply
>> because no-one else but Cython actually needs them there). So we sometimes
>> end up rewriting parts of its C-API in a way that allows us to reimplement
>> the correct Python semantics on top of them.
>
>
> what about wrapping these "cython hacks" into some macros (which would be
> defined only when compiling against CPython)? This way, they would still
> have the same semantic/performance when compiling for CPython, but that
> would still allow PyPy to implement them.
>
> Basically, I'm proposing to unoficially extend a bit the C API so that PyPy
> and Cython can meet. I agree that in the long run this is probably not the
> best solution, however it might be interesting in the short run.

That would be neat, interfacing at the C level is much easier than at
a Python + ctypes level in many ways for Cython. Forgive my ignorance,
but is there a complete-ish overview of which parts of the CPython C
API are available? Perhaps the generated C code can also appease the
GC in some way instead of refcounting the objects?

As a further point of interest, is there any support for the buffer
interface (PEP 3118)?

On a side note, me and Dag Sverre will be at PyCon this year to attend
the main conference and to do some sprinting on Cython. Perhaps we
could draw up a concrete proposal that could make pypy and Cython work
together.

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

Reply via email to