diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2009-01-11 17:57:21 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2009-01-11 17:57:21 +0000 |
commit | cca31dde4ff9e50162c1f0d309837f5b27c0ef04 (patch) | |
tree | 622d12861d9bfe322155e49e2125c931d55f7bce | |
parent | 4b5c817793380cc6692d7abebffd664682788808 (diff) | |
download | swig-cca31dde4ff9e50162c1f0d309837f5b27c0ef04.tar.gz |
more portable pointer in a string comparison
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11054 626c5289-ae23-0410-ae9c-e8d60b6d4f22
-rw-r--r-- | Examples/test-suite/python/swigobject_runme.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Examples/test-suite/python/swigobject_runme.py b/Examples/test-suite/python/swigobject_runme.py index ad78ee4fb..8d77faa80 100644 --- a/Examples/test-suite/python/swigobject_runme.py +++ b/Examples/test-suite/python/swigobject_runme.py @@ -1,5 +1,8 @@ from swigobject import * +from string import replace +from string import upper +from string import lstrip a = A() @@ -12,15 +15,17 @@ if a1.this != a2.this: lthis = long(a.this) -# match pointer value, but deal with leading zeros on 8/16 bit systems -xstr8bit = "%08X" % (lthis,) -xstr16bit = "%016X" % (lthis,) +# match pointer value, but deal with leading zeros on 8/16 bit systems and different C++ compilers interpretation of %p +xstr1 = "%016X" % (lthis,) +xstr1 = lstrip(xstr1, '0') xstr2 = pointer_str(a) +xstr2 = replace(xstr2, "0x", "") +xstr2 = replace(xstr2, "0X", "") +xstr2 = upper(xstr2) -if xstr8bit != xstr2: - if xstr16bit != xstr2: - print xstr8bit, xstr16bit, xstr2 - raise RuntimeError +if xstr1 != xstr2: + print xstr1, xstr2 + raise RuntimeError s = str(a.this) r = repr(a.this) |