[pypy-dev] Bringing Cython and PyPy closer together

Stefan Behnel stefan_ml at behnel.de
Sat Feb 18 14:36:45 CET 2012

Amaury Forgeot d'Arc, 18.02.2012 10:08:
> 2012/2/18 Stefan Behnel
> I made some modifications to pypy, cython and lxml,
> and now I can compile and install cython, lxml, and they seem to work!
> Here are the changes I made, some parts are really hacks and should be
> polished:
> lxml: http://paste.pocoo.org/show/552903/
> cython: http://paste.pocoo.org/show/552904/

The exception handling code that you deleted in __Pyx_GetException(), that
which accesses exc_type and friends, is actually needed for correct
semantics of Cython code and Python code. Basically, it implements the part
of the except clause that moves the hot exception into sys.exc_info().

This equally applies to __Pyx_ExceptionSave() and __Pyx_ExceptionReset(),
which form something like an exception backup frame around code sections
that may raise exceptions themselves but must otherwise not touch the
current exception. Specifically, as part of the finally clause.

In order to fix this, is there a way to store away and restore the current
sys.exc_info() in PyPy?


More information about the pypy-dev mailing list