[pypy-svn] r53626 - in pypy/branch/jit-hotpath/pypy/rpython/ootypesystem: . test
antocuni at codespeak.net
antocuni at codespeak.net
Wed Apr 9 20:43:15 CEST 2008
Author: antocuni
Date: Wed Apr 9 20:43:13 2008
New Revision: 53626
Modified:
pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/ootype.py
pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/test/test_ootype.py
Log:
a failing test and the corresponding fix
Modified: pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/ootype.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/ootype.py (original)
+++ pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/ootype.py Wed Apr 9 20:43:13 2008
@@ -731,7 +731,12 @@
def __eq__(self, other):
if not isinstance(other, _object):
raise TypeError("comparing an _object with %r" % other)
- return self.obj == other.obj
+ if self.obj is None:
+ return other.obj is None
+ elif other.obj is None:
+ return self.obj is None
+ else:
+ return self.obj == other.obj
def __ne__(self, other):
return not (self == other)
Modified: pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/test/test_ootype.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/test/test_ootype.py (original)
+++ pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/test/test_ootype.py Wed Apr 9 20:43:13 2008
@@ -577,3 +577,11 @@
assert obj1 == obj2
assert cast_from_object(A, obj1) == a
assert cast_from_object(B, obj2) == b
+
+def test_cast_object_compare_null():
+ A = Instance("Foo", ROOT)
+ a = new(A)
+ obj1 = cast_to_object(a)
+ assert NULL != obj1
+ assert obj1 != NULL
+
More information about the Pypy-commit
mailing list