[pypy-dev] offtopic, ontopic, ...

Antonio Cuni anto.cuni at gmail.com
Tue Feb 14 00:04:40 CET 2012

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.


More information about the pypy-dev mailing list