The following piece of code is behaving incorrectly in my script:
from ctypes import *
base_addr = c_uint64(0)
base_addr_temp = c_uint64(0)
print base_addr
print base_addr_temp
if(base_addr == base_addr_temp):
print "val"
The output that I get:
c_ulong(0L)
c_ulong(0L)
I am using Python version 2.7.3.
I think that because these are objects, you’d have to compare them by value:
It’s been a while since I’ve done any Python, but in many languages, two objects are only considered “equal” if they actually refer to the same object (i.e. reference the same location in memory).