Author: Alex Gaynor <alex.gay...@gmail.com> Branch: numpy-dtype-alt Changeset: r46720:543e7f4d7d3a Date: 2011-08-23 05:58 -0500 http://bitbucket.org/pypy/pypy/changeset/543e7f4d7d3a/
Log: fix translation diff --git a/pypy/module/micronumpy/interp_dtype.py b/pypy/module/micronumpy/interp_dtype.py --- a/pypy/module/micronumpy/interp_dtype.py +++ b/pypy/module/micronumpy/interp_dtype.py @@ -115,7 +115,7 @@ def binop(func): @functools.wraps(func) def impl(self, v1, v2): - return self.box(func(self, self.unbox(v1), self.unbox(v2))) + return self.adapt_val(func(self, self.unbox(v1), self.unbox(v2))) return impl def unaryop(func): @@ -220,7 +220,7 @@ @binop def add(self, v1, v2): - return v1 + v2 + return widen(v1) + widen(v2) def str_format(self, item): return str(widen(self.unbox(item))) diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py --- a/pypy/module/micronumpy/test/test_dtypes.py +++ b/pypy/module/micronumpy/test/test_dtypes.py @@ -73,3 +73,11 @@ for i in range(10): assert isinstance(a[i], int) assert a[1] == 1 + + def test_add_int8(self): + from numpy import array + + a = array(range(5), dtype="int8") + b = a + a + for i in range(5): + assert b[i] == i * 2 \ No newline at end of file _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit