[pypy-svn] pypy fast-forward: Translation fixes

amauryfa commits-noreply at bitbucket.org
Mon Jan 10 18:52:14 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40562:e482547128f8
Date: 2011-01-10 18:50 +0100
http://bitbucket.org/pypy/pypy/changeset/e482547128f8/

Log:	Translation fixes

diff --git a/pypy/interpreter/buffer.py b/pypy/interpreter/buffer.py
--- a/pypy/interpreter/buffer.py
+++ b/pypy/interpreter/buffer.py
@@ -223,6 +223,7 @@
 
     def getslice(self, start, stop, step, size):
         if step == 1:
+            assert start >= 0 and stop >= 0
             return self.value[start:stop]
         return "".join([self.value[start + i*step] for i in xrange(size)])
 

diff --git a/pypy/module/array/interp_array.py b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -334,6 +334,7 @@
         start, stop, step, size = space.decode_index4(w_slice, self.len)
         w_a = mytype.w_class(self.space)
         w_a.setlen(size)
+        assert step != 0
         j = 0
         for i in range(start, stop, step):
             w_a.buffer[j] = self.buffer[i]
@@ -353,6 +354,7 @@
 
     def setitem__Array_Slice_Array(space, self, w_idx, w_item):
         start, stop, step, size = self.space.decode_index4(w_idx, self.len)
+        assert step != 0
         if w_item.len != size:
             w_lst = array_tolist__Array(space, self)
             w_item = space.call_method(w_item, 'tolist')


More information about the Pypy-commit mailing list