[pypy-commit] pypy default: a setslice mutates the array

hakanardo noreply at buildbot.pypy.org
Fri Sep 30 20:06:17 CEST 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: 
Changeset: r47723:631873ac63b7
Date: 2011-09-30 20:02 +0200
http://bitbucket.org/pypy/pypy/changeset/631873ac63b7/

Log:	a setslice mutates the array

diff --git a/pypy/annotation/test/test_annrpython.py b/pypy/annotation/test/test_annrpython.py
--- a/pypy/annotation/test/test_annrpython.py
+++ b/pypy/annotation/test/test_annrpython.py
@@ -3204,6 +3204,8 @@
         s = a.build_types(f, [])
         assert isinstance(s, annmodel.SomeList)
         assert not s.listdef.listitem.resized
+        assert not s.listdef.listitem.immutable
+        assert s.listdef.listitem.mutated
 
     def test_delslice(self):
         def f():
diff --git a/pypy/annotation/unaryop.py b/pypy/annotation/unaryop.py
--- a/pypy/annotation/unaryop.py
+++ b/pypy/annotation/unaryop.py
@@ -352,6 +352,7 @@
         check_negative_slice(s_start, s_stop)
         if not isinstance(s_iterable, SomeList):
             raise Exception("list[start:stop] = x: x must be a list")
+        lst.listdef.mutate()
         lst.listdef.agree(s_iterable.listdef)
         # note that setslice is not allowed to resize a list in RPython
 


More information about the pypy-commit mailing list