[pypy-svn] r18648 - in pypy/dist/pypy/rpython/ootypesystem: . test
mwh at codespeak.net
mwh at codespeak.net
Sat Oct 15 18:24:44 CEST 2005
Author: mwh
Date: Sat Oct 15 18:24:38 2005
New Revision: 18648
Modified:
pypy/dist/pypy/rpython/ootypesystem/rclass.py
pypy/dist/pypy/rpython/ootypesystem/test/test_ooclean.py
Log:
(boria, mwh, bert)
some support for superclasses (no methods yet though)
Modified: pypy/dist/pypy/rpython/ootypesystem/rclass.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/rclass.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/rclass.py Sat Oct 15 18:24:38 2005
@@ -1,6 +1,6 @@
from pypy.rpython.rmodel import inputconst
from pypy.rpython.rclass import AbstractClassRepr, AbstractInstanceRepr, \
- getclassrepr
+ getinstancerepr
from pypy.rpython.ootypesystem import ootype
CLASSTYPE = ootype.Class
@@ -22,12 +22,15 @@
def __init__(self, rtyper, classdef, does_need_gc=True):
AbstractInstanceRepr.__init__(self, rtyper, classdef)
- self.lowleveltype = ootype.Instance(classdef.cls.__name__, None, {}, {})
+ b = self.classdef.basedef
+ if b is not None:
+ b = getinstancerepr(rtyper, b).lowleveltype
+
+ self.lowleveltype = ootype.Instance(classdef.cls.__name__, b, {}, {})
self.prebuiltinstances = {} # { id(x): (x, _ptr) }
def _setup_repr(self):
# FIXME methods
- assert self.classdef.basedef is None
fields = {}
attrs = self.classdef.attrs.items()
Modified: pypy/dist/pypy/rpython/ootypesystem/test/test_ooclean.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/test/test_ooclean.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/test/test_ooclean.py Sat Oct 15 18:24:38 2005
@@ -56,3 +56,17 @@
return x.a
specialize(dummyfn, [])
+class Subclass(EmptyBase):
+ pass
+
+def test_subclass_attributes():
+ def dummyfn():
+ x = EmptyBase()
+ x.a = 1
+ y = Subclass()
+ y.a = 2
+ y.b = 3
+ return x.a + y.a + y.b
+ specialize(dummyfn, [])
+
+
More information about the Pypy-commit
mailing list