summaryrefslogtreecommitdiff
path: root/numpy/ma
diff options
context:
space:
mode:
authorMark Wiebe <mwwiebe@gmail.com>2011-01-21 00:54:09 -0800
committerMark Wiebe <mwwiebe@gmail.com>2011-01-21 09:01:23 -0800
commit87596cf6a0e6becccea111727435605fa3615e49 (patch)
tree0a393998c502827db23cb06ef800a7cb6ea4c5db /numpy/ma
parent6c6dc487ca15818d1f4cc764debb15d73a61c03b (diff)
downloadnumpy-87596cf6a0e6becccea111727435605fa3615e49.tar.gz
ENH: ufunc: Make many more tests pass with the new ufunc code
Diffstat (limited to 'numpy/ma')
-rw-r--r--numpy/ma/core.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 98100621e..673cfb1ab 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -940,7 +940,9 @@ class _MaskedBinaryOperation:
# Revert result to da where masked
if m.any():
np.putmask(result, m, 0)
- result += m * da
+ # This only makes sense if the operation preserved the dtype
+ if result.dtype == da.dtype:
+ result += m * da
# Transforms to a (subclass of) MaskedArray
result = result.view(get_masked_subclass(a, b))
result._mask = m