[pypy-commit] pypy default: fix more ufunc result dtypes

bdkearns noreply at buildbot.pypy.org
Wed Feb 19 19:01:02 CET 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r69209:3907f379b172
Date: 2014-02-19 12:59 -0500
http://bitbucket.org/pypy/pypy/changeset/3907f379b172/

Log:	fix more ufunc result dtypes

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
@@ -186,7 +186,7 @@
                     space, obj.get_dtype(),
                     promote_to_float=self.promote_to_float,
                     promote_to_largest=self.promote_to_largest,
-                    promote_bools=True
+                    promote_bools=self.promote_bools,
                 )
         if self.identity is None:
             for i in range(shapelen):
diff --git a/pypy/module/micronumpy/test/test_ufuncs.py b/pypy/module/micronumpy/test/test_ufuncs.py
--- a/pypy/module/micronumpy/test/test_ufuncs.py
+++ b/pypy/module/micronumpy/test/test_ufuncs.py
@@ -1031,7 +1031,7 @@
         assert logaddexp2(float('inf'), float('inf')) == float('inf')
 
     def test_accumulate(self):
-        from numpypy import add, multiply, arange, dtype
+        from numpypy import add, subtract, multiply, divide, arange, dtype
         assert (add.accumulate([2, 3, 5]) == [2, 5, 10]).all()
         assert (multiply.accumulate([2, 3, 5]) == [2, 6, 30]).all()
         a = arange(4).reshape(2,2)
@@ -1049,6 +1049,8 @@
         assert b.dtype == int
         assert add.accumulate([True]*200)[-1] == 200
         assert add.accumulate([True]*200).dtype == dtype('int')
+        assert subtract.accumulate([True]*200).dtype == dtype('bool')
+        assert divide.accumulate([True]*200).dtype == dtype('int8')
 
     def test_noncommutative_reduce_accumulate(self):
         import numpypy as np


More information about the pypy-commit mailing list