Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r53256:d57e1fff2623 Date: 2012-03-04 23:33 +0100 http://bitbucket.org/pypy/pypy/changeset/d57e1fff2623/
Log: Test and fix. diff --git a/pypy/annotation/description.py b/pypy/annotation/description.py --- a/pypy/annotation/description.py +++ b/pypy/annotation/description.py @@ -425,8 +425,8 @@ raise Exception("unsupported: class %r has mixin bases both" " before and after the regular base" % (self,)) self.add_mixins(mixins_after, check_not_in=base) + self.add_mixins(mixins_before) self.add_sources_for_class(cls) - self.add_mixins(mixins_before) if base is not object: self.basedesc = bookkeeper.getdesc(base) diff --git a/pypy/annotation/test/test_annrpython.py b/pypy/annotation/test/test_annrpython.py --- a/pypy/annotation/test/test_annrpython.py +++ b/pypy/annotation/test/test_annrpython.py @@ -2463,6 +2463,20 @@ s = a.build_types(f, []) assert s.const == 5 + def test_mixin_concrete(self): + class Mixin(object): + _mixin_ = True + def foo(self): return 4 + class Concrete(Mixin): + def foo(self): return 5 + def f(): + return Concrete().foo() + + assert f() == 5 + a = self.RPythonAnnotator() + s = a.build_types(f, []) + assert s.const == 5 + def test_multiple_mixins_mro(self): # an obscure situation, but it occurred in module/micronumpy/types.py class A(object): _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit