summaryrefslogtreecommitdiff
path: root/numpy/lib/nanfunctions.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/nanfunctions.py')
-rw-r--r--numpy/lib/nanfunctions.py8
1 files changed, 2 insertions, 6 deletions
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)