Re: Exception stomping
Stefan Behnel <[email protected]> Wed, 26 Nov 2008 09:22:04 +0100
| Newsgroups | gmane.comp.python.pyrex |
|---|---|
| Message-ID | <[email protected]> |
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