Author: Maciej Fijalkowski <fij...@gmail.com> Branch: Changeset: r49943:831d8e975963 Date: 2011-11-29 10:33 +0200 http://bitbucket.org/pypy/pypy/changeset/831d8e975963/
Log: fixes diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py --- a/pypy/module/micronumpy/compile.py +++ b/pypy/module/micronumpy/compile.py @@ -69,8 +69,12 @@ if start < 0: start += size if stop < 0: - stop += size - return (start, stop, step, (stop - start)//step + 1) + stop += size + 1 + if step < 0: + lgt = (stop - start + 1) / step + 1 + else: + lgt = (stop - start - 1) / step + 1 + return (start, stop, step, lgt) @specialize.argtype(1) def wrap(self, obj): diff --git a/pypy/module/micronumpy/test/test_compile.py b/pypy/module/micronumpy/test/test_compile.py --- a/pypy/module/micronumpy/test/test_compile.py +++ b/pypy/module/micronumpy/test/test_compile.py @@ -221,3 +221,14 @@ b -> 3 """) assert interp.results[0].value.val == 6 + + def test_set_slice2(self): + interp = self.run(""" + a = |30| + b = |10| + b[1] = 5.5 + c = b + b + a[0:30:3] = c + a -> 3 + """) + assert interp.results[0].value.val == 11 _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit