[Pyrex] Pyrex exception type checking broken under Python 2.5 (and earlier)

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Jun 25 04:58:08 UTC 2006


Stefan Behnel wrote:

> Pyrex uses this code in __Pyx_Raise() to check if an exception object has the
> right type for being raised:

> The problem is that exceptions in Py2.5 have become new-style classes which no
> longer fall under any of the above checks.

 > Also, support for string exceptions is deprecated and supposed to be
> removed in later Python versions. I therefore propose to actually remove the
> above check from Pyrex completely.

What I'd really like is an API call for raising an exception that
does all the same things as the Python raise statement. There
didn't seem to be such a call at the time I wrote that code.

I'd be wary about removing the checks altogether, because I
wouldn't be surprised if you could cause a crash by stuffing
arbitrary values into the exception variables.

It definitely needs updating for 2.5, though, and I take the
point about string exceptions. I'll probably drop support for
them.

--
Greg



More information about the Pyrex mailing list