1 2from swigobject import * 3 4a = A() 5 6 7a1 = a_ptr(a) 8a2 = a_ptr(a) 9 10if a1.this != a2.this: 11 raise RuntimeError 12 13 14lthis = long(a.this) 15# match pointer value, but deal with leading zeros on 8/16 bit systems and 16# different C++ compilers interpretation of %p 17xstr1 = "%016X" % (lthis,) 18xstr1 = str.lstrip(xstr1, "0") 19xstr2 = pointer_str(a) 20xstr2 = str.replace(xstr2, "0x", "") 21xstr2 = str.replace(xstr2, "0X", "") 22xstr2 = str.lstrip(xstr2, "0") 23xstr2 = str.upper(xstr2) 24 25if xstr1 != xstr2: 26 print xstr1, xstr2 27 raise RuntimeError 28 29s = str(a.this) 30r = repr(a.this) 31 32v1 = v_ptr(a) 33v2 = v_ptr(a) 34if long(v1) != long(v2): 35 raise RuntimeError 36