From 6d52633c90ec6a669dae6a63fe6dac6d1a736cab Mon Sep 17 00:00:00 2001 From: Julian Taylor Date: Sat, 24 Dec 2016 13:54:52 +0100 Subject: TST: extend ma.median testing and fix inconsistent out return --- numpy/ma/extras.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'numpy/ma/extras.py') diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py index 97fb647e9..1774ece30 100644 --- a/numpy/ma/extras.py +++ b/numpy/ma/extras.py @@ -729,6 +729,10 @@ def _median(a, axis=None, out=None, overwrite_input=False): s = mid.sum(out=out) if not odd: s = np.true_divide(s, 2., casting='safe', out=out) + # masked ufuncs do not fullfill `returned is out` (gh-8416) + # fix this to return the same in the nd path + if out is not None: + s = out s = np.lib.utils._median_nancheck(asorted, s, axis, out) else: s = mid.mean(out=out) -- cgit v1.2.1