[Pyrex] Handling exception when embedding
Greg Ewing
greg.ewing at canterbury.ac.nz
Mon Nov 19 00:30:39 CET 2007
Franck Pommereau wrote:
> I have problems to retrieve the information related to
> exceptions from the C program
I'm having a bit of trouble following what your code is meant
to do. I can't find anywhere that you're catching the exception
you're trying to use exc_info() to get information about. If
the exception hasn't been caught with an 'except' clause,
you won't be able to get it through exc_info().
What it looks like will happen is that the exception will
propagate as far as the Foo_hello function, but won't be able
to go any further because it hasn't been declared with an
exception value, so you will get a message about an unhandled
exception.
But in any case, I don't think exc_info() will work at all with
an exception caught by a Pyrex try-except statement, because it
uses information stored in the Python stack frame, and Pyrex
functions don't have Python stack frames.
> I get the following message:
>
> *** AttributeError: 'NoneType' object has no attribute '__name__' ***
Is that *all* you get? I would have expected a message about an
unhandled exception in Foo_hello prior to that.
--
Greg
More information about the Pyrex
mailing list