[Pyrex] Exception stomping

Stefan Behnel stefan_ml at behnel.de
Wed Nov 26 09:22:04 CET 2008


Hi,

Eric Huss wrote:
> I've run into a problem with how Pyrex handles the "current" exception
> (not sure if this has been discussed before).  I know that the "reraise"
> issue has been fixed, but this is a slightly different issue where Pyrex
> does not make a backup of the "current" exception.
> 
> If you call a Pyrex function that internally raises and catches an
> exception, but does not re-raise it, it leaves that exception set within
> the tstate object.  This causes the exception to bleed out in unexpected
> ways.

Please take a look at the way Cython 0.10.1 handles this. It stores the
current exception away when it enters a try block and restores it when an
exception has been caught in an except block and successfully handled (i.e.
the except block has exited normally).

Stefan




More information about the Pyrex mailing list