Getting the current PyCFunction while in a python function

Prémon Nom lib_team at yahoo.fr
Wed Aug 26 04:08:48 EDT 2009


Hi

I would like to get the PyCFunction object which corresponds to the current function which is executed. I call PyFrameObject* frame = PyEval_GetFrame()

I try to parse frame->f_valuestack, but I don't know how to get the index of the function in the stack or event the size of the stack to be able to parse it (from end to begin and to stop on the first PyCFunctionObject).
There is a member call stack size (frame->f_valuestack->f_code->co_stacksize) but it doesn't correspond to the frame->f_valuestack size :-(
In fact i know that when i call "print(myFunctionPrintNumber(123))
There is PyCfunctionObject corresponding to myFunctionPrintNumber but i don't know how to acces it :/ because i don't know how to get/compute frame->f_valuestack size or to get/compute directly
 the index where the current executed function is.

Please help me!!!

Regards



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090826/a1ee47ae/attachment.html>


More information about the Python-list mailing list