Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > f->f_locals is NULL for a method call

Thread Tools

f->f_locals is NULL for a method call

Vijay Kumar
Posts: n/a

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?

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
createImage sometime returns null and sometime returns non-null. vizlab Java 3 10-17-2007 11:21 AM
Cannot invoke Call with null namespace URI for method null Java 0 05-12-2006 01:34 PM
"stringObj == null" vs "stringObj.equals(null)", for null check?? Java 5 03-29-2006 10:37 PM
null parameter in method call different in 1.4 v.s. 1.5? Java 10 08-02-2005 04:30 PM
VB.NET Null to SQL Null (ASP.NET 2.0 GridView) Kivak Wolf ASP .Net 2 06-28-2005 02:01 PM