From c607456d9eac8743e5280adeec5496fd2621ae6a Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 27 Apr 2017 23:01:49 +0100 Subject: MAINT: Remove weird create-a-copy dance --- numpy/lib/nanfunctions.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'numpy/lib/nanfunctions.py') diff --git a/numpy/lib/nanfunctions.py b/numpy/lib/nanfunctions.py index c96e925aa..d9df9563f 100644 --- a/numpy/lib/nanfunctions.py +++ b/numpy/lib/nanfunctions.py @@ -61,14 +61,10 @@ def _replace_nan(a, val): NaNs, otherwise return None. """ - is_new = not isinstance(a, np.ndarray) - if is_new: - a = np.array(a) + a = np.array(a, subok=True, copy=True) + if not issubclass(a.dtype.type, np.inexact): return a, None - if not is_new: - # need copy - a = np.array(a, subok=True) mask = np.isnan(a) np.copyto(a, val, where=mask) -- cgit v1.2.1