diff options
Diffstat (limited to 'numpy/ma/core.py')
| -rw-r--r-- | numpy/ma/core.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 719961d1b..56c761da1 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -3029,18 +3029,20 @@ class MaskedArray(ndarray): if context is not None: result._mask = result._mask.copy() - (func, args, _) = context - m = reduce(mask_or, [getmaskarray(arg) for arg in args]) + func, args, out_i = context + # args sometimes contains outputs (gh-10459), which we don't want + input_args = args[:func.nin] + m = reduce(mask_or, [getmaskarray(arg) for arg in input_args]) # Get the domain mask domain = ufunc_domain.get(func, None) if domain is not None: # Take the domain, and make sure it's a ndarray - if len(args) > 2: + if len(input_args) > 2: with np.errstate(divide='ignore', invalid='ignore'): - d = filled(reduce(domain, args), True) + d = filled(reduce(domain, input_args), True) else: with np.errstate(divide='ignore', invalid='ignore'): - d = filled(domain(*args), True) + d = filled(domain(*input_args), True) if d.any(): # Fill the result where the domain is wrong |
