PyFrameObject question

Stephen Kellett snail at objmedia.demon.co.uk
Thu Feb 20 06:28:31 EST 2003


>Using the C Python API, if I have got a PyFrameObject how do I get a
>symbol name for this frame?

I'll answer my own question :-)

1) PyString_ToString(frame->f_code->co_filename);
        to get a char * for the filename

2) PyString_ToString(frame->f_code->co_name);
to get a char * for the method name. returns '?' for methods that have
no name.

Shame the docs for this side of things are not clearer. The joys of
writing software tools....

Regards

Stephen
-- 
Stephen Kellett         http://www.objmedia.demon.co.uk
Object Media Limited    C++/Java/Windows NT/Unix/X Windows/Multimedia
If you are suffering from RSI, contact me for advice.
Unsolicited email from spam merchants not welcome.




More information about the Python-list mailing list