[pypy-commit] pypy default: test, fix for pypy/numpy issue number 34
mattip
noreply at buildbot.pypy.org
Sun Jul 12 22:47:53 CEST 2015
Author: mattip <matti.picus at gmail.com>
Branch:
Changeset: r78540:1f1d7e1c14c2
Date: 2015-07-12 23:48 +0300
http://bitbucket.org/pypy/pypy/changeset/1f1d7e1c14c2/
Log: test, fix for pypy/numpy issue number 34
diff --git a/pypy/module/micronumpy/strides.py b/pypy/module/micronumpy/strides.py
--- a/pypy/module/micronumpy/strides.py
+++ b/pypy/module/micronumpy/strides.py
@@ -77,7 +77,7 @@
stop = 1
step = 1
lgt = 1
- axis_step = 0
+ axis_step = 0 # both skip this axis in calculate_slice_strides and set stride => 0
def __init__(self):
pass
@@ -127,7 +127,7 @@
except IndexError:
continue
if chunk.step != 0:
- rstrides[j] = s_i * chunk.step
+ rstrides[j] = s_i * chunk.step * chunk.axis_step
rbackstrides[j] = s_i * max(0, chunk.lgt - 1) * chunk.step
rshape[j] = chunk.lgt
j += 1
diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py
--- a/pypy/module/micronumpy/test/test_ndarray.py
+++ b/pypy/module/micronumpy/test/test_ndarray.py
@@ -764,6 +764,8 @@
assert (a[1:] == b).all()
assert (a[1:,newaxis] == d).all()
assert (a[newaxis,1:] == c).all()
+ assert a.strides == (8,)
+ assert a[:, newaxis].strides == (8, 0)
def test_newaxis_assign(self):
from numpy import array, newaxis
More information about the pypy-commit
mailing list