Python C Object Comparison

A

Anand K Rayudu

Dear All,

I have some question regarding embedding and exposing of C pointers.

We have embedded python and extended to expose our APIs and c objects to
python.
Every thing is working fine as far as customizing our application
through python.

How ever i am expecting following behavior but it failed. Can some oe
suggest a work around!!

Here is my python code

import myModule

a=myModule.myAPI1("1")
b=myModule.myAPI2("name")

# basically both above functions return same C pointer.
# so i want to compare
if(a==b): print "They are same"
else : print "They are different"

python always prints they are different,
I guess this is because in python layer we create PythonCObject for
every C pointer, and that is how it is exposed to python. Though both
the APIs are returning the same C pointer, they are different instances
of PythonCObject.
So i guess that is the reason comparison is failing.
How ever is it possible to make python to compare actual C pointer,
rather than the PythonCObject Pointer.

Can some one please suggest

Regards,
Anand
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top