Using Python traceback info from C/C++.

Duncan Booth me at privacy.net
Mon Jul 12 05:46:05 EDT 2004


Jeff Holle <jeff.holle at verizon.net> wrote in 
news:mailman.235.1089594168.5135.python-list at python.org:

> I've seen numerous examples of how to obtain part of this info.  They 
> basically all start with a call to PyErr_Fetch.
> This function takes 3 args, the last being traceback.  All of them do 
> not use this variable.
> 
> In looking at Python 2.3.3's C API, I haven't found any functions that 
> seem to help it obtaining the traceback information.
> 
> Have I missed something?
> 

You obtain the traceback information by calling PyErr_Fetch. The third 
argument to PyErr_Fetch is a pointer to a PyObject* that will be filled in 
with the traceback information.

Once you have a traceback object you can manipulate it using the functions 
in the traceback module.



More information about the Python-list mailing list