467,076 Members | 974 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,076 developers. It's quick & easy.

f->f_locals is NULL for a method call


I have written a trace function in C using the Python/C API. I want to
find whether the call occured is a function call or method call and if
a method call, its self object.

int tracer(PyObject *obj, PyObject *f, int what, PyObject *args){
PyObject *item,*SelfItem;
case PyTrace_CALL: {
if(f->f_code->co_argcount>0 &&
//checks if the call is a method call
SelfItem = f->f_locals;
} else printf("Function");
} }

The SelfItem obtained is a NULL object (for method call).But when I
wrote the same trace function in python, f->f_locals is a dictionary
with "self" as a keyword.
How can i get the dictionary in C?

Jul 19 '05 #1
  • viewed: 1068

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by David Sworder | last post: by
3 posts views Thread by No Spam Man | last post: by
4 posts views Thread by Olivier Nizet | last post: by
2 posts views Thread by Paul Drummond | last post: by
8 posts views Thread by nsharma78@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.