[Tutor] Getting traceback info from C-API
stefan_ml at behnel.de
Tue Apr 6 08:23:24 CEST 2010
Shu, 06.04.2010 01:06:
> I have a CAPI extension module that is giving me MemoryError
> exceptions from once in a while with no other information
MemoryError is a bit special in that it usually only occurs when memory
allocation fails, in which case raising a new exception object would likely
also fail. So there is a pre-allocated MemoryError instance without any
error text that can be raised in this case.
> so clearly
> none of my exception handlers are catching it. Is there any way I can
> traceback information for the extension module?
Is it a module that you have written yourself? In that case, you can
manually add traceback information for each function in your code. There is
a PyTraceBack_Here() function for that.
However, it might be easier to just rewrite your module in Cython, which
will do this automatically for every function you write.
More information about the Tutor