Raising exceptions during call back

Makhno mak at imakhno.freeserve.co.uk
Mon May 29 12:54:57 EDT 2000


>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.

I wanted to avoid this because the error can occur in many places and it's
non-trivial to change my code to return NULL everytime, espcially as my
module is scripting-language independant. And I was uncertain if it'd
actually work propelly anyway given how traceback.print_stack() had worked.

>Alternatively, if you want to print the backtrace in the module, use
>PyErr_Print().

Yes, I found this worked as it should. Followed by exit(1) it does what I
need.







More information about the Python-list mailing list