[pypy-svn] r9626 - pypy/branch/annotation-no-rev-num
arigo at codespeak.net
arigo at codespeak.net
Fri Mar 4 14:48:18 CET 2005
Author: arigo
Date: Fri Mar 4 14:48:18 2005
New Revision: 9626
Modified:
pypy/branch/annotation-no-rev-num/classdef.py
Log:
Mixins bug fix.
Modified: pypy/branch/annotation-no-rev-num/classdef.py
==============================================================================
--- pypy/branch/annotation-no-rev-num/classdef.py (original)
+++ pypy/branch/annotation-no-rev-num/classdef.py Fri Mar 4 14:48:18 2005
@@ -50,6 +50,7 @@
self.subdefs = {}
base = object
mixeddict = {}
+ sources = {}
baselist = list(cls.__bases__)
baselist.reverse()
for b1 in baselist:
@@ -59,6 +60,8 @@
assert b1.__bases__ == () or b1.__bases__ == (object,), (
"mixin class %r should have no base" % (b1,))
mixeddict.update(b1.__dict__)
+ for name in b1.__dict__:
+ sources[name] = b1
else:
assert base is object, ("multiple inheritance only supported "
"with _mixin_: %r" % (cls,))
@@ -75,7 +78,7 @@
continue
if isinstance(value, FunctionType):
value.class_ = cls # remember that this is really a method
- self.add_source_for_attribute(name, cls, self)
+ self.add_source_for_attribute(name, sources.get(name, cls), self)
def add_source_for_attribute(self, attr, source, clsdef=None):
self.find_attribute(attr).sources[source] = clsdef
More information about the Pypy-commit
mailing list