Exceptions in Extensions: weird problem

Martin v. Loewis martin at v.loewis.de
Wed Apr 24 03:23:13 EDT 2002


Harald Kirsch <kirschh at lionbioscience.com> writes:

> How can step (4) initialize/augment the error traceback with the
> traceback information generated in step (1)?

If you can guarantee that no other Python exception occurs between
step 1 and step 4, just don't perform PyErr_Clear() in step 2
(i.e. don't "catch" the exception); then use PyErr_Fetch in step 4 to
get the exception object and traceback. You might even just return
NULL, in which case the pending exception will continue to unwind the
Python stack.

HTH,
Martin



More information about the Python-list mailing list