Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r75897:6b4ac7be0d78
Date: 2015-02-15 16:05 +0100
http://bitbucket.org/pypy/pypy/changeset/6b4ac7be0d78/

Log:    Test and fix (discovered by 5eb6bfa9ec8e)

diff --git a/rpython/annotator/listdef.py b/rpython/annotator/listdef.py
--- a/rpython/annotator/listdef.py
+++ b/rpython/annotator/listdef.py
@@ -158,6 +158,10 @@
         s_other_value = other.read_item()
         self.generalize(s_other_value)
         other.generalize(s_self_value)
+        if self.listitem.range_step is not None:
+            self.generalize_range_step(other.listitem.range_step)
+        if other.listitem.range_step is not None:
+            other.generalize_range_step(self.listitem.range_step)
 
     def offspring(self, *others):
         s_self_value = self.read_item()
diff --git a/rpython/rtyper/test/test_rrange.py 
b/rpython/rtyper/test/test_rrange.py
--- a/rpython/rtyper/test/test_rrange.py
+++ b/rpython/rtyper/test/test_rrange.py
@@ -184,3 +184,11 @@
             return 5
         res = self.interpret(fn, [1])
         assert res == 20
+
+    def test_extend_range(self):
+        def fn(n):
+            lst = [n, n, n]
+            lst.extend(range(n))
+            return len(lst)
+        res = self.interpret(fn, [5])
+        assert res == 8
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to