C-API: Extract information from function object

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Mar 24 12:49:30 EDT 2010


En Wed, 24 Mar 2010 12:09:27 -0300, moerchendiser2k3  
<googler.1.webmaster at spamgourmet.com> escribió:

> I have a reference to a function and would like to know how to extract
> information from a function object.
>
> Information I am looking for: line and file where this function is
> from.
>
> PyObject_Call can do this to when I call a function object and
> something failed so these information are written to the traceback. So
> any suggestions how to do that?

See the Language Reference; the associated code object holds the file and  
starting line the function comes from.
The traceback object contains better information (like the line being  
executed instead of the first one). Why don't you use it instead?

-- 
Gabriel Genellina




More information about the Python-list mailing list