[Python-Dev] Tracebacks into C code

Phillip J. Eby pje at telecommunity.com
Mon Jan 12 15:11:59 EST 2004


At 12:10 PM 1/11/04 -0500, 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"?

Pyrex generates code to do this, at least for C functions that it 
"compiles" from Python code; you might look at its generated C code for 
working examples.




More information about the Python-Dev mailing list