diff --git a/Examples/test-suite/python/swigobject.i b/Examples/test-suite/python/swigobject.i index 760b64025..cd802cf38 100644 --- a/Examples/test-suite/python/swigobject.i +++ b/Examples/test-suite/python/swigobject.i @@ -10,7 +10,7 @@ const char* pointer_str(A *a){ static char result[1024]; - sprintf(result,"%x",a); + sprintf(result,"%p",a); return result; } diff --git a/Examples/test-suite/python/swigobject_runme.py b/Examples/test-suite/python/swigobject_runme.py index c8fda5c21..7c2992dff 100644 --- a/Examples/test-suite/python/swigobject_runme.py +++ b/Examples/test-suite/python/swigobject_runme.py @@ -11,10 +11,12 @@ if a1.this != a2.this: lthis = long(a.this) -xstr1 = "%x" % (lthis,) +xstr1 = "0x%x" % (lthis,) xstr2 = pointer_str(a) +print hex(lthis) if xstr1 != xstr2: + print xstr1, xstr2 raise RuntimeError s = str(a.this) diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index be910835b..ffb9043e3 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -120,7 +120,7 @@ SWIGRUNTIME PyObject * PySwigObject_hex(PySwigObject *v) { char buf[100]; - PyOS_snprintf(buf, sizeof(buf), "0x%lx", (unsigned long)v->ptr); + PyOS_snprintf(buf, sizeof(buf), "%p", v->ptr); return PyString_FromString(buf); }