[pypy-svn] r63900 - in pypy/branch/pyjitpl5-simplify/pypy/annotation: . test

antocuni at codespeak.net antocuni at codespeak.net
Thu Apr 9 16:36:38 CEST 2009


Author: antocuni
Date: Thu Apr  9 16:36:38 2009
New Revision: 63900

Modified:
   pypy/branch/pyjitpl5-simplify/pypy/annotation/binaryop.py
   pypy/branch/pyjitpl5-simplify/pypy/annotation/test/test_model.py
Log:
this is a replay of r59142 by antocuni

---------------
a failing test and the corresponding fix
---------------



Modified: pypy/branch/pyjitpl5-simplify/pypy/annotation/binaryop.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/annotation/binaryop.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/annotation/binaryop.py	Thu Apr  9 16:36:38 2009
@@ -898,6 +898,8 @@
             common = r2.ootype
         elif r2.ootype is None:
             common = r1.ootype
+        elif isinstance(r1.ootype, ootype.BuiltinType) or isinstance(r2.ootype, ootype.BuiltinType):
+            common = ootype.Object
         else:
             common = ootype.commonBaseclass(r1.ootype, r2.ootype)
             assert common is not None, ('Mixing of incompatible classes %r, %r'

Modified: pypy/branch/pyjitpl5-simplify/pypy/annotation/test/test_model.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/annotation/test/test_model.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/annotation/test/test_model.py	Thu Apr  9 16:36:38 2009
@@ -192,6 +192,14 @@
 
     assert unionof(SomeOOInstance(C1), SomeOOInstance(D)) == SomeOOInstance(ROOT)
 
+def test_ooclass_array_contains():
+    A = ootype.Array(ootype.Signed)
+    cls = ootype.runtimeClass(A)
+    s1 = SomeOOClass(A)
+    s2 = SomeOOClass(A)
+    s2.const=cls
+    assert s1.contains(s2)
+
 if __name__ == '__main__':
     for name, value in globals().items():
         if name.startswith('test_'):



More information about the Pypy-commit mailing list