[Pyrex] Reraise not inside except clause

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Oct 17 00:47:07 CEST 2007


Robert Kern wrote:

> The code looks correct to me. Can you see anything wrong with it?

Okay, I've looked at it, and I can see what he's doing.
But a try-except block would achieve pretty much the
same thing. The code generated by 0.9.2 for a try-except
that doesn't catch the exception value would be almost
identical to what he's written out the hard way here.

So my fix for this would be to rip all that stuff out
and replace it with getattr() (which compiles to a
PyObject_GetAttr call in 0.9.2) and a try-except block
containing a reraise.

The next release will also have a getattr3() function
(3-argument form) which could be used as an alternative.

--
Greg



More information about the Pyrex mailing list