summaryrefslogtreecommitdiff
path: root/numpy/ma
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2020-12-05 22:38:47 -0600
committerSebastian Berg <sebastian@sipsolutions.net>2021-03-18 15:37:20 -0500
commitf531110689a646f574ad1529d78b6047cf397f3e (patch)
tree4d5b1114309098fcda080557f2fd32ad1bbcdf08 /numpy/ma
parent9c68c2f7b1b2128a3b4af2134565f60d286fa8b9 (diff)
downloadnumpy-f531110689a646f574ad1529d78b6047cf397f3e.tar.gz
ENH: Use new argument parsing for array creation functions
The array creation functions have the most to gain: 1. np.asarray is 4 times faster and commonly used. 2. Other functions are wrapped using __array_function__ in Python making it more difficult This commit (unfortunatly) has to do a few things: * Modify __array_function__ C-side dispatching to accomodate the fastcall argument convention. * Move asarray, etc. to C after removing all "fast paths" from np.array (simplifying the code) * Fixup imports, since asarray was imported directly in a few places * Replace some places where `np.array` was probably used for speed instead of np.asarray or similar. (or by accident in 1 or 2 places)
Diffstat (limited to 'numpy/ma')
-rw-r--r--numpy/ma/core.py2
-rw-r--r--numpy/ma/testutils.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 10ee0fb06..90c808df4 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -3895,7 +3895,7 @@ class MaskedArray(ndarray):
# Force the condition to a regular ndarray and forget the missing
# values.
- condition = np.array(condition, copy=False, subok=False)
+ condition = np.asarray(condition)
_new = _data.compress(condition, axis=axis, out=out).view(type(self))
_new._update_from(self)
diff --git a/numpy/ma/testutils.py b/numpy/ma/testutils.py
index 8d55e1763..2dd479abe 100644
--- a/numpy/ma/testutils.py
+++ b/numpy/ma/testutils.py
@@ -134,8 +134,8 @@ def assert_equal(actual, desired, err_msg=''):
msg = build_err_msg([actual, desired],
err_msg, header='', names=('x', 'y'))
raise ValueError(msg)
- actual = np.array(actual, copy=False, subok=True)
- desired = np.array(desired, copy=False, subok=True)
+ actual = np.asanyarray(actual)
+ desired = np.asanyarray(desired)
(actual_dtype, desired_dtype) = (actual.dtype, desired.dtype)
if actual_dtype.char == "S" and desired_dtype.char == "S":
return _assert_equal_on_sequences(actual.tolist(),