
*Martin v. Löwis wrote:*
Edward C. Jones wrote:
/ Suppose: /> >/ I have a Python extension written in C. /> >/ "My_Func" is a function in the extension which is visible at the /> >/ Python level. /> >/ "My_Func" calls the C function "C_func1". /> >/ "C_func1" calls the C function "C_func2". /> >/ "C_func2" raises an exception by calling something like /> >/ "PyErr_SetString". />/ How do I make the Python traceback include "C_func1" and "C_func2"? /> You need to create frame objects. See Modules/pyexpat.c for an example.
That looks complicated.
Regards, Martin
P.S. This is OT for python-dev.
I should have directly asked: Should some traceback-through-C capability be put in the Python API?

Martin:
Edward C. Jones wrote:
Should some traceback-through-C capability be put in the Python API?
But there is traceback-through-C capability in the Python API!
Is there? Can you point me towards some documentation? Anything that could reduce the contortions Pyrex currently performs to achieve this would be welcome... Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+

Greg Ewing wrote:
But there is traceback-through-C capability in the Python API!
Is there? Can you point me towards some documentation?
It's undocumented. See pyexpat.c for an example.
Anything that could reduce the contortions Pyrex currently performs to achieve this would be welcome...
That is unlikely. The mere fact that Pyrex made it possible through contortions demonstrates that the capability is in the API. Regards, Martin
participants (3)
-
"Martin v. Löwis"
-
Edward C. Jones
-
Greg Ewing