Author: mattip Branch: numpypy-out Changeset: r52628:ac37eef6dfb6 Date: 2012-02-19 11:20 +0200 http://bitbucket.org/pypy/pypy/changeset/ac37eef6dfb6/
Log: translation fix, revert incorrect box conversion 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 @@ -1107,7 +1107,7 @@ """ def setitem(self, item, value): self.invalidated() - self.dtype.setitem(self.storage, item, value.convert_to(self.dtype)) + self.dtype.setitem(self.storage, item, value) def setshape(self, space, new_shape): self.shape = new_shape diff --git a/pypy/module/micronumpy/interp_ufuncs.py b/pypy/module/micronumpy/interp_ufuncs.py --- a/pypy/module/micronumpy/interp_ufuncs.py +++ b/pypy/module/micronumpy/interp_ufuncs.py @@ -260,7 +260,7 @@ out = arr return space.wrap(out) if out: - #Test shape compatability + assert isinstance(out, BaseArray) # For translation broadcast_shape = shape_agreement(space, w_obj.shape, out.shape) if not broadcast_shape or broadcast_shape != out.shape: raise operationerrfmt(space.w_ValueError, diff --git a/pypy/module/micronumpy/test/test_outarg.py b/pypy/module/micronumpy/test/test_outarg.py --- a/pypy/module/micronumpy/test/test_outarg.py +++ b/pypy/module/micronumpy/test/test_outarg.py @@ -81,8 +81,19 @@ def test_ufunc_cast(self): from _numpypy import array, negative - cast_error = raises(TypeError, negative, array(16,dtype=float), - out=array(0, dtype=int)) - assert str(cast_error.value) == \ + a = array(16, dtype = int) + c = array(0, dtype = float) + b = negative(a, out=c) + assert b == c + try: + from _numpypy import version + v = version.version.split('.') + except: + v = ['1', '6', '0'] # numpypy is api compatable to what version? + if v[0]<'2': + b = negative(c, out=a) + assert b == a + else: + cast_error = raises(TypeError, negative, c, a) + assert str(cast_error.value) == \ "Cannot cast ufunc negative output from dtype('float64') to dtype('int64') with casting rule 'same_kind'" - _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit