Re: Printing the exception traceback in C code

Guido.van.Rossum@cwi.nl
Thu, 18 Aug 1994 15:01:16 +0200

> I call a python function from C (call_object), which sometimes raises an
> exception. How do I get hold of the exception's trace back from the
> C function?

Why would you want to do that?

The function tb_fetch() gives you the traceback object. "Gives you"
is quite literal: it clears the global variable from which it fetches
it and you have to DECREF() the object you get when you're done with
it. To give it back, use tb_store() -- but you still have to DECREF()
it.

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
<URL:http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>