[pypy-svn] r18771 - in pypy/dist/pypy/rpython: . ootypesystem ootypesystem/test
arigo at codespeak.net
arigo at codespeak.net
Wed Oct 19 20:14:54 CEST 2005
Author: arigo
Date: Wed Oct 19 20:14:53 2005
New Revision: 18771
Modified:
pypy/dist/pypy/rpython/llinterp.py
pypy/dist/pypy/rpython/ootypesystem/rclass.py
pypy/dist/pypy/rpython/ootypesystem/test/test_ooclean.py
Log:
The last test from the lltyper's test_rclass.py: llinterpreting
void fields.
Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py (original)
+++ pypy/dist/pypy/rpython/llinterp.py Wed Oct 19 20:14:53 2005
@@ -631,7 +631,9 @@
def op_oosetfield(self, inst, name, value):
assert isinstance(inst, ootype._instance)
assert isinstance(name, str)
- setattr(inst, name, value)
+ FIELDTYPE = self.llt.typeOf(inst)._field_type(name)
+ if FIELDTYPE != self.llt.Void:
+ setattr(inst, name, value)
def op_oogetfield(self, inst, name):
assert isinstance(inst, ootype._instance)
Modified: pypy/dist/pypy/rpython/ootypesystem/rclass.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/rclass.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/rclass.py Wed Oct 19 20:14:53 2005
@@ -219,7 +219,8 @@
attr = hop.args_s[1].const
mangled = mangle(attr)
self.lowleveltype._check_field(mangled)
- v_inst, _, v_newval = hop.inputargs(self, ootype.Void, hop.args_r[2])
+ r_value = self.allfields[mangled]
+ v_inst, _, v_newval = hop.inputargs(self, ootype.Void, r_value)
v_attr = hop.inputconst(ootype.Void, mangled)
return hop.genop('oosetfield', [v_inst, v_attr, v_newval])
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 Wed Oct 19 20:14:53 2005
@@ -481,3 +481,13 @@
assert res is False
res = interpret(f, [0])
assert res is False
+
+def test_void_fnptr():
+ def g():
+ return 42
+ def f():
+ e = EmptyBase()
+ e.attr = g
+ return e.attr()
+ res = interpret(f, [])
+ assert res == 42
More information about the Pypy-commit
mailing list