how to get a function object from a frame object

2005-05-17 Thread Vijay Kumar
I have written a trace function and it recieves the current frame object from the interpreter. I want to know whether the event pertains to a class or method or function. I can only get a code object from this frame object but not a function object or class object. Please post if any body have

Re: How to get a Function object from a Frame object

2005-04-22 Thread Gigi
Greg Ewing wrote: Steven Bethard wrote: Gigi wrote: I need access to a function object that corresponds to a frame object in a certain case from inside the function. Can you look up the code's co_name in the previous frame's locals? You probably also need to check the previous frame's globals...

Re: How to get a Function object from a Frame object

2005-04-19 Thread Greg Ewing
Steven Bethard wrote: Gigi wrote: I need access to a function object that corresponds to a frame object in a certain case from inside the function. Can you look up the code's co_name in the previous frame's locals? You probably also need to check the previous frame's globals... And there are

How to get a Function object from a Frame object

2005-04-18 Thread Gigi
Hi, I need access to a function object that corresponds to a frame object in a certain case from inside the function. I can get the frame object using: f = sys._getframe(0) But the resulting frame object doesn't contain the information I need. There is a lot of information in the code object

Re: How to get a Function object from a Frame object

2005-04-18 Thread Steven Bethard
Gigi wrote: I need access to a function object that corresponds to a frame object in a certain case from inside the function. I can get the frame object using: f = sys._getframe(0) But the resulting frame object doesn't contain the information I need. There is a lot of information in the code