[pypy-commit] pypy numpy-fixes: test for 0-dim array
mattip
noreply at buildbot.pypy.org
Sat May 2 20:40:30 CEST 2015
Author: mattip <matti.picus at gmail.com>
Branch: numpy-fixes
Changeset: r76981:36a16b711ea6
Date: 2015-05-02 21:05 +0300
http://bitbucket.org/pypy/pypy/changeset/36a16b711ea6/
Log: test for 0-dim array
diff --git a/pypy/module/micronumpy/concrete.py b/pypy/module/micronumpy/concrete.py
--- a/pypy/module/micronumpy/concrete.py
+++ b/pypy/module/micronumpy/concrete.py
@@ -333,13 +333,17 @@
# but make the array storage contiguous in memory
shape = self.get_shape()
strides = self.get_strides()
- mins = strides[0]
- t_elsize = dtype.elsize
- for s in strides:
- if s < mins:
- mins = s
- t_strides = [s * t_elsize / mins for s in strides]
- backstrides = calc_backstrides(t_strides, shape)
+ if len(strides) > 0:
+ mins = strides[0]
+ t_elsize = dtype.elsize
+ for s in strides:
+ if s < mins:
+ mins = s
+ t_strides = [s * t_elsize / mins for s in strides]
+ backstrides = calc_backstrides(t_strides, shape)
+ else:
+ t_strides = []
+ backstrides = []
impl = ConcreteArray(shape, dtype, self.order, t_strides, backstrides)
loop.setslice(space, impl.get_shape(), impl, self)
return impl
More information about the pypy-commit
mailing list