473,695 Members | 3,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

f->f_locals is NULL for a method call

hi,

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 ;
switch(what){
case PyTrace_CALL: {
printf("%s",PyS tring_AS_STRING (f->f_code->co_name));
if(f->f_code->co_argcount> 0 &&
strcmp(PyString _AS_STRING(PyTu ple_GetItem(f->f_code->co_varnames,0) ,"self")==0)
{
//checks if the call is a method call
printf("Method\ n");
SelfItem = f->f_locals;
} else printf("Functio n");
} }

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?

Thanks,
Vijay.
Jul 19 '05 #1
0 1213

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
24708
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream s); public void Deserialize(Stream s); Within the MyUserControl class, there is a field of type MyInnerClass
3
3147
by: No Spam Man | last post by:
I've got an app that I've written using C# and some type libraries I've generated from some of the directx .IDL files. I have got a problem with calling some of the methods on the generated interfaces. As an example, I've got a method I want to call that has a parameter call reserved, that must be null or the method call fails with unexpected parameter. int method(int p1, int p2, DWORD *reserverd)
16
3748
by: Stefan Hong | last post by:
Hi, It seems that the way reflection resolves methods is not quite the same as default CLR. For example this simple class: class Test { public void Hello(string name) { Console.WriteLine("Hello(string)"); } public void Hello(object obj) {
14
3153
by: MuZZy | last post by:
Hi, Lately i've been (and still am) fixing some memory leaks problems in the project i just took over when i got this new job. Among the other issues i've noticed that for localy created objects it makes difference to explicitly put them to null after working with them is done - it somehow makes the GC collect them sooner, like here: void SomeFunc() { MyClass c = new MyClass();
4
1642
by: Olivier Nizet | last post by:
Hi, while investigating the Framework dlls via Reflector, I found this code : System.Drawing.Graphics : public void DrawImage(Image image, int x, int y) { if (this == null) throw new ArgumentNullException("this");
2
1603
by: Paul Drummond | last post by:
Hi all, I am developing a new python debugger which is coming on quite nicely except that f_locals always becomes NULL when entering new functions. Can anyone help with this? Someone else has posted earlier with a similar problem but there are no replies. I can't understand why f_locals would be NULL - it works fine at the module level but as soon as I "step into" a function, the contents of frame->f_locals when converted to a string...
8
3345
by: nsharma78 | last post by:
Hi, I have a code as follows: class A { public: void print(){cout << "Magic" << endl;} };
16
2344
by: cody | last post by:
Shouldn't if (this!=null) generate a compiler warning? in fact, it does not.
11
3254
by: MikeT | last post by:
This may sound very elementary, but can you trap when your object is set to null within the object? I have created a class that registers an event from an object passed in the constructor. When my object is destroyed, I want my object to un-register this event. If I don't then the object would never be destroyed until the object I passed in the constructor is destroyed. I have implemented a Dispose(), Dispose(bool), and ~Finalize...
19
2716
by: Michael C | last post by:
If we have something like this object x = null; MessageBox.Show(x.ToString()) we get an error. That kindof makes sense but there is no reason the behaviour couldn't be to return an empty string. When we call x.ToString we are really calling a function like this: class Object
0
8582
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9122
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8860
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7672
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5841
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4348
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4587
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3018
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1984
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.