Raising exceptions during call back
Martin von Loewis
loewis at informatik.hu-berlin.de
Mon May 29 17:53:56 CEST 2000
"Makhno" <mak at imakhno.freeserve.co.uk> writes:
> def mysub():
> print t #error!
> If I call print_stack() from the extension module, I only get trace
> information up to the EnterCallBack() call, it says nothing about where an
> error occured inside mysub(), which I'm sure you can imagine would make it
> very difficult to write code for.
When you get an exception in a C module, immediately release all
resources, and return NULL as well. That way, the entire stack will
wind up, and Python will print the full traceback.
Alternatively, if you want to print the backtrace in the module, use
More information about the Python-list