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/core/fromnumeric.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/core/fromnumeric.py')
-rw-r--r-- | numpy/core/fromnumeric.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index 67d2c5b48..1bb9738fb 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -445,7 +445,13 @@ def put(a, ind, v, mode='raise'): array([ 0, 1, 2, 3, -5]) """ - return a.put(ind, v, mode) + try: + put = a.put + except AttributeError: + raise TypeError("argument 1 must be numpy.ndarray, " + "not {name}".format(name=type(a).__name__)) + + return put(ind, v, mode) def swapaxes(a, axis1, axis2): |