[pypy-svn] r13283 - in pypy/dist/pypy: rpython translator/genc/test

arigo at codespeak.net arigo at codespeak.net
Sat Jun 11 00:11:13 CEST 2005


Author: arigo
Date: Sat Jun 11 00:11:09 2005
New Revision: 13283

Modified:
   pypy/dist/pypy/rpython/rtyper.py
   pypy/dist/pypy/translator/genc/test/inprogress_test_typed.py
Log:
Bug fix in rtyper.
Simplified test.


Modified: pypy/dist/pypy/rpython/rtyper.py
==============================================================================
--- pypy/dist/pypy/rpython/rtyper.py	(original)
+++ pypy/dist/pypy/rpython/rtyper.py	Sat Jun 11 00:11:09 2005
@@ -280,6 +280,8 @@
         self.s_result = rtyper.binding(spaceop.result)
         self.args_r   = [rtyper.getrepr(s_a) for s_a in self.args_s]
         self.r_result = rtyper.getrepr(self.s_result)
+        for r in self.args_r + [self.r_result]:
+            r.setup()
 
     def inputarg(self, converted_to, arg):
         """Returns the arg'th input argument of the current operation,

Modified: pypy/dist/pypy/translator/genc/test/inprogress_test_typed.py
==============================================================================
--- pypy/dist/pypy/translator/genc/test/inprogress_test_typed.py	(original)
+++ pypy/dist/pypy/translator/genc/test/inprogress_test_typed.py	Sat Jun 11 00:11:09 2005
@@ -36,19 +36,33 @@
         assert result == (1, 5)
 
     def test_get_set_del_slice(self):
-        def get_set_del_nonneg_slice(l=list): # no neg slices for now!
+        def get_set_del_nonneg_slice(): # no neg slices for now!
+            l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
             del l[:1]
-            del l[len(l)-1:]
+            bound = len(l)-1
+            if bound >= 0:
+                del l[bound:]
             del l[2:4]
-            l[:1] = [3]
-            l[len(l)-1:] = [9]
-            l[2:4] = [8,11]
-            return l[:2], l[5:], l[3:5]        
+            #l[:1] = [3]
+            #bound = len(l)-1
+            #assert bound >= 0
+            #l[bound:] = [9]    no setting slice into lists for now
+            #l[2:4] = [8,11]
+            l[0], l[-1], l[2], l[3] = 3, 9, 8, 11
+
+            list_3_c = l[:2]
+            list_9 = l[5:]
+            list_11_h = l[3:5]
+            return (len(l), l[0], l[1], l[2], l[3], l[4], l[5],
+                    len(list_3_c),  list_3_c[0],  list_3_c[1],
+                    len(list_9),    list_9[0],
+                    len(list_11_h), list_11_h[0], list_11_h[1])
         fn = self.getcompiled(get_set_del_nonneg_slice)
-        l = list('abcdefghij')
-        result = fn(l)
-        assert l == [3, 'c', 8, 11, 'h', 9]
-        assert result == ([3, 'c'], [9], [11, 'h'])
+        result = fn()
+        assert result == (6, 3, 'c', 8, 11, 'h', 9,
+                          2, 3, 'c',
+                          1, 9,
+                          2, 11, 'h')
 
     def test_slice_long(self):
         "the parent's test_slice_long() makes no sense here"



More information about the Pypy-commit mailing list