Author: mattip <[email protected]>
Branch:
Changeset: r62342:a5c03ba0f6bc
Date: 2013-03-12 21:21 -0700
http://bitbucket.org/pypy/pypy/changeset/a5c03ba0f6bc/
Log: reorder checks for upstream compatability, enable pedantic test
diff --git a/pypy/module/micronumpy/interp_arrayops.py
b/pypy/module/micronumpy/interp_arrayops.py
--- a/pypy/module/micronumpy/interp_arrayops.py
+++ b/pypy/module/micronumpy/interp_arrayops.py
@@ -109,19 +109,19 @@
_axis = axis
if axis < 0:
_axis = len(shape) + axis
- if _axis < 0 or len(shape) <= _axis:
- raise operationerrfmt(space.w_IndexError, "axis %d out of bounds [0,
%d)", axis, len(shape))
for arr in args_w[1:]:
- dtype = interp_ufuncs.find_binop_result_dtype(space, dtype,
- arr.get_dtype())
- if _axis < 0 or len(arr.get_shape()) <= _axis:
- raise operationerrfmt(space.w_IndexError, "axis %d out of bounds
[0, %d)", axis, len(shape))
for i, axis_size in enumerate(arr.get_shape()):
if len(arr.get_shape()) != len(shape) or (i != _axis and axis_size
!= shape[i]):
raise OperationError(space.w_ValueError, space.wrap(
"all the input arrays must have same number of
dimensions"))
elif i == _axis:
shape[i] += axis_size
+ dtype = interp_ufuncs.find_binop_result_dtype(space, dtype,
+ arr.get_dtype())
+ if _axis < 0 or len(arr.get_shape()) <= _axis:
+ raise operationerrfmt(space.w_IndexError, "axis %d out of bounds
[0, %d)", axis, len(shape))
+ if _axis < 0 or len(shape) <= _axis:
+ raise operationerrfmt(space.w_IndexError, "axis %d out of bounds [0,
%d)", axis, len(shape))
res = W_NDimArray.from_shape(shape, dtype, 'C')
chunks = [Chunk(0, i, 1, i) for i in shape]
axis_start = 0
diff --git a/pypy/module/micronumpy/test/test_numarray.py
b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -1470,12 +1470,11 @@
assert str(exc.value) == \
"all the input arrays must have same number of dimensions"
- if 0: # XXX too pedantic
- g1 = array([0,1,2])
- g2 = array([[3,4,5]])
- exc = raises(ValueError, concatenate, (g1, g2), axis=2)
- assert str(exc.value) == \
- "all the input arrays must have same number of dimensions"
+ g1 = array([0,1,2])
+ g2 = array([[3,4,5]])
+ exc = raises(ValueError, concatenate, (g1, g2), axis=2)
+ assert str(exc.value) == \
+ "all the input arrays must have same number of dimensions"
a = array([1, 2, 3, 4, 5, 6])
a = (a + a)[::2]
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit