diff options
author | gfyoung <gfyoung@mit.edu> | 2016-01-12 23:16:57 +0000 |
---|---|---|
committer | gfyoung <gfyoung@mit.edu> | 2016-01-14 19:05:31 +0000 |
commit | 02bcbd7e99f7b73c2abcb2726f79ea01a6bba2da (patch) | |
tree | 1ea2b8bfa8af4b3b99806933de189a83ef48e901 /numpy/lib/function_base.py | |
parent | 8fa6e3bef26a6d4a2c92f2824129aa4409be2590 (diff) | |
download | numpy-02bcbd7e99f7b73c2abcb2726f79ea01a6bba2da.tar.gz |
DOC, MAINT: Enforce np.ndarray arg for np.put and np.place
np.put and np.place do something only when the first argument
is an instance of np.ndarray. These changes will cause a TypeError
to be thrown in either function should that requirement not be
satisfied.
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 9bc128f92..844c069c0 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -1779,7 +1779,7 @@ def place(arr, mask, vals): Parameters ---------- - arr : array_like + arr : ndarray Array to put data into. mask : array_like Boolean mask array. Must have the same size as `a`. @@ -1801,6 +1801,10 @@ def place(arr, mask, vals): [44, 55, 44]]) """ + if not isinstance(arr, np.ndarray): + raise TypeError("argument 1 must be numpy.ndarray, " + "not {name}".format(name=type(arr).__name__)) + return _insert(arr, mask, vals) |