Author: Maciej Fijalkowski <[email protected]>
Branch: virtual-arguments
Changeset: r56250:242667f43d36
Date: 2012-07-20 10:39 +0200
http://bitbucket.org/pypy/pypy/changeset/242667f43d36/
Log: backout a4da9e06f8bf
diff --git a/pypy/module/micronumpy/interp_iter.py
b/pypy/module/micronumpy/interp_iter.py
--- a/pypy/module/micronumpy/interp_iter.py
+++ b/pypy/module/micronumpy/interp_iter.py
@@ -214,7 +214,6 @@
def next(self, shapelen):
shapelen = jit.promote(len(self.res_shape))
offset = self.offset
- assert shapelen >= 0
indices = [0] * shapelen
for i in range(shapelen):
indices[i] = self.indices[i]
@@ -242,7 +241,6 @@
def next_skip_x(self, shapelen, step):
shapelen = jit.promote(len(self.res_shape))
offset = self.offset
- assert shapelen >= 0
indices = [0] * shapelen
for i in range(shapelen):
indices[i] = self.indices[i]
@@ -307,7 +305,6 @@
def next(self, shapelen):
offset = self.offset
first_line = self.first_line
- assert shapelen >= 0
indices = [0] * shapelen
for i in range(shapelen):
indices[i] = self.indices[i]
@@ -345,9 +342,7 @@
class SkipLastAxisIterator(object):
def __init__(self, arr):
self.arr = arr
- lgt = (len(arr.shape) - 1)
- assert lgt >= 0
- self.indices = [0] * lgt
+ self.indices = [0] * (len(arr.shape) - 1)
self.done = False
self.offset = arr.start
diff --git a/pypy/module/micronumpy/interp_numarray.py
b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -797,7 +797,6 @@
loop.compute(ra)
if self.res:
broadcast_dims = len(self.res.shape) - len(self.shape)
- assert broadcast_dims >= 0
chunks = [Chunk(0,0,0,0)] * broadcast_dims + \
[Chunk(0, i, 1, i) for i in self.shape]
return Chunks(chunks).apply(self.res)
@@ -1271,9 +1270,10 @@
shapelen = len(shape)
if w_ndmin is not None and not space.is_w(w_ndmin, space.w_None):
ndmin = space.int_w(w_ndmin)
- lgt = (ndmin - shapelen)
- if lgt > 0:
- shape = [1] * lgt + shape
+ if ndmin > shapelen:
+ lgt = (ndmin - shapelen) + shape
+ assert lgt >= 0
+ shape = [1] * lgt
shapelen = ndmin
arr = W_NDimArray(shape[:], dtype=dtype, order=order)
arr_iter = arr.create_iter()
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
@@ -43,12 +43,8 @@
else:
rstrides.append(strides[i])
rbackstrides.append(backstrides[i])
- lgt = (len(res_shape) - len(orig_shape))
- assert lgt >= 0
- rstrides = [0] * lgt + rstrides
- lgt = (len(res_shape) - len(orig_shape))
- assert lgt >= 0
- rbackstrides = [0] * lgt + rbackstrides
+ rstrides = [0] * (len(res_shape) - len(orig_shape)) + rstrides
+ rbackstrides = [0] * (len(res_shape) - len(orig_shape)) + rbackstrides
return rstrides, rbackstrides
def is_single_elem(space, w_elem, is_rec_type):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit