[pypy-svn] r14165 - in pypy/dist/pypy/rpython: . test
arigo at codespeak.net
arigo at codespeak.net
Sun Jul 3 18:42:43 CEST 2005
Author: arigo
Date: Sun Jul 3 18:42:40 2005
New Revision: 14165
Modified:
pypy/dist/pypy/rpython/rclass.py
pypy/dist/pypy/rpython/test/test_rclass.py
Log:
Support Void attributes for prebuilt instances.
Modified: pypy/dist/pypy/rpython/rclass.py
==============================================================================
--- pypy/dist/pypy/rpython/rclass.py (original)
+++ pypy/dist/pypy/rpython/rclass.py Sun Jul 3 18:42:40 2005
@@ -397,8 +397,11 @@
result.super)
# then add instance attributes from this level
for name, (mangled_name, r) in self.fields.items():
- attrvalue = getattr(value, name)
- llattrvalue = r.convert_const(attrvalue)
+ if r.lowleveltype == Void:
+ llattrvalue = None
+ else:
+ attrvalue = getattr(value, name)
+ llattrvalue = r.convert_const(attrvalue)
setattr(result, mangled_name, llattrvalue)
else:
# OBJECT part
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 Sun Jul 3 18:42:40 2005
@@ -63,6 +63,16 @@
res = interpret(dummyfn, [])
assert res == 6
+def test_prebuilt_instances_with_void():
+ def marker():
+ return 42
+ a = EmptyBase()
+ a.nothing_special = marker
+ def dummyfn():
+ return a.nothing_special()
+ res = interpret(dummyfn, [])
+ assert res == 42
+
# method calls
class A:
def f(self):
More information about the Pypy-commit
mailing list