470,841 Members | 1,063 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,841 developers. It's quick & easy.

Using Python traceback info from C/C++.

I'm interested in turning a Python Exception into a C++ exception in a
Python Embedding application.

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?

If not, is it safe to look into the implementation files of python and
copy the pertinent portion into my application?
Jul 18 '05 #1
1 2177
Jeff Holle <je********@verizon.net> wrote in
news:ma*************************************@pytho n.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.
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Don Bruder | last post: by
7 posts views Thread by Carl Waldbieser | last post: by
5 posts views Thread by Michael Foord | last post: by
2 posts views Thread by Fernando Perez | last post: by
20 posts views Thread by Lucas Raab | last post: by
reply views Thread by Richard Taylor | last post: by
reply views Thread by Kurt B. Kaiser | last post: by
3 posts views Thread by jefishman | last post: by
1 post views Thread by jmalone | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.