[pypy-svn] r26769 - in pypy/dist/pypy: annotation annotation/test rpython/test

cfbolz at codespeak.net cfbolz at codespeak.net
Fri May 5 00:36:24 CEST 2006


Author: cfbolz
Date: Fri May  5 00:36:17 2006
New Revision: 26769

Modified:
   pypy/dist/pypy/annotation/description.py
   pypy/dist/pypy/annotation/test/test_annrpython.py
   pypy/dist/pypy/rpython/test/test_rclass.py
Log:
make it possible to inherit from classes that have a mixin


Modified: pypy/dist/pypy/annotation/description.py
==============================================================================
--- pypy/dist/pypy/annotation/description.py	(original)
+++ pypy/dist/pypy/annotation/description.py	Fri May  5 00:36:17 2006
@@ -333,7 +333,7 @@
             for b1 in baselist:
                 if b1 is object:
                     continue
-                if getattr(b1, '_mixin_', False):
+                if b1.__dict__.get('_mixin_', False):
                     assert b1.__bases__ == () or b1.__bases__ == (object,), (
                         "mixin class %r should have no base" % (b1,))
                     self.add_sources_for_class(b1, mixin=True)

Modified: pypy/dist/pypy/annotation/test/test_annrpython.py
==============================================================================
--- pypy/dist/pypy/annotation/test/test_annrpython.py	(original)
+++ pypy/dist/pypy/annotation/test/test_annrpython.py	Fri May  5 00:36:17 2006
@@ -2018,17 +2018,23 @@
         class B(Base, Mixin):
             pass
 
+        class C(B):
+            pass
+
         def f():
             a = A()
             v0 = a.m(2)
             b = B()
             v1 = b.m('x')
-            return v0, v1
+            c = C()
+            v2 = c.m('y')
+            return v0, v1, v2
 
         a = self.RPythonAnnotator()
         s = a.build_types(f, [])
         assert isinstance(s.items[0], annmodel.SomeInteger)
         assert isinstance(s.items[1], annmodel.SomeChar)        
+        assert isinstance(s.items[2], annmodel.SomeChar)        
         
 
 def g(n):

Modified: pypy/dist/pypy/rpython/test/test_rclass.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rclass.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rclass.py	Fri May  5 00:36:17 2006
@@ -448,12 +448,17 @@
         class B(Base, Mixin):
             pass
 
+        class C(B):
+            pass
+
         def f():
             a = A()
             v0 = a.m(2)
             b = B()
             v1 = b.m('x')
-            return v0, v1
+            c = C()
+            v2 = c.m('y')
+            return v0, v1, v2
 
         res = interpret(f, [], type_system=self.ts)
         assert typeOf(res.item0) == Signed



More information about the Pypy-commit mailing list