[pypy-svn] r27626 - in pypy/dist/pypy/rpython: . test

arigo at codespeak.net arigo at codespeak.net
Tue May 23 18:16:02 CEST 2006


Author: arigo
Date: Tue May 23 18:16:01 2006
New Revision: 27626

Modified:
   pypy/dist/pypy/rpython/rtuple.py
   pypy/dist/pypy/rpython/test/test_rtuple.py
Log:
Fix&test for constant tuples with void items.


Modified: pypy/dist/pypy/rpython/rtuple.py
==============================================================================
--- pypy/dist/pypy/rpython/rtuple.py	(original)
+++ pypy/dist/pypy/rpython/rtuple.py	Tue May 23 18:16:01 2006
@@ -111,7 +111,8 @@
             p = self.instantiate()
             self.tuple_cache[key] = p
             for obj, r, name in zip(value, self.items_r, self.fieldnames):
-                setattr(p, name, r.convert_const(obj))
+                if r.lowleveltype is not Void:
+                    setattr(p, name, r.convert_const(obj))
             return p
 
     def compact_repr(self):

Modified: pypy/dist/pypy/rpython/test/test_rtuple.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rtuple.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rtuple.py	Tue May 23 18:16:01 2006
@@ -230,6 +230,19 @@
         res = self.interpret(g, [3])
         assert res == 3
 
+    def test_void_items(self):
+        def f():
+            return 6
+        def getf():
+            return f
+        def g():
+            f1 = getf()
+            return (f1, 12)
+        def example():
+            return g()[0]()
+        res = self.interpret(example, [])
+        assert res == 6
+
 class TestLLtype(BaseTestRtuple, LLRtypeMixin):
     pass
 



More information about the Pypy-commit mailing list