Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r78969:7d34a1f415dc
Date: 2015-08-13 15:37 +0100
http://bitbucket.org/pypy/pypy/changeset/7d34a1f415dc/

Log:    merge heads

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
@@ -1166,6 +1166,7 @@
         assert (logical_xor([True, False, True, False], [1, 2, 0, 0])
                 == [False, True, True, False]).all()
         assert (logical_not([True, False]) == [False, True]).all()
+        assert logical_and.reduce([1.,1.]) == True
 
     def test_logn(self):
         import math
diff --git a/pypy/module/micronumpy/ufuncs.py b/pypy/module/micronumpy/ufuncs.py
--- a/pypy/module/micronumpy/ufuncs.py
+++ b/pypy/module/micronumpy/ufuncs.py
@@ -511,15 +511,15 @@
         W_Ufunc.__init__(self, name, promote_to_largest, promote_to_float, 
promote_bools,
                          identity, int_only, allow_bool, allow_complex, 
complex_to_float)
         self.func = func
-        self.bool_result = bool_result
         if name == 'logical_and':
             self.done_func = done_if_false
         elif name == 'logical_or':
             self.done_func = done_if_true
         else:
             self.done_func = None
+        self.bool_result = bool_result or (self.done_func is not None)
         self.simple_binary = (
-            allow_complex and allow_bool and not bool_result and not int_only
+            allow_complex and allow_bool and not self.bool_result and not 
int_only
             and not complex_to_float and not promote_to_float
             and not promote_bools)
 
@@ -630,7 +630,7 @@
                                             r_dtype.is_complex())):
             raise oefmt(space.w_TypeError,
                 "ufunc '%s' not supported for the input types", self.name)
-        if self.bool_result:
+        if self.bool_result and not self.done_func:
             # XXX: should actually pass the arrays
             dtype = find_result_type(space, [], [l_dtype, r_dtype])
             bool_dtype = get_dtype_cache(space).w_booldtype
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to