[pypy-dev] Bringing Cython and PyPy closer together

Amaury Forgeot d'Arc amauryfa at gmail.com
Sat Feb 18 14:52:30 CET 2012


2012/2/18 Stefan Behnel <stefan_ml at behnel.de>

> 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?
>

I certainly was a bit fast to remove code there, and these
exc_value and curexc_value have always been a delicate
part of the CPython interpreter.

One thing I don't understand for example, is why Cython needs to deal with
sys.exc_info, when no other extension uses it for exception management.

The only way to know for sure is to have unit tests with different use
cases.

-- 
Amaury Forgeot d'Arc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120218/2e6cb7d6/attachment.html>


More information about the pypy-dev mailing list