diff options
author | Jarl Haggerty <jarl@covetouscat.com> | 2014-09-27 16:08:15 -0400 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2014-10-21 17:40:30 -0600 |
commit | 892c46910c7f9f0211f01b42f9aa81d0db892c8e (patch) | |
tree | 67f3abab6a67707871c4ec8331d280b7f5dc88a2 /numpy/core | |
parent | 2f1e27610453f901e81cd892b2aa3b3a2ac30819 (diff) | |
download | numpy-892c46910c7f9f0211f01b42f9aa81d0db892c8e.tar.gz |
BUG: Make PyArray_PutTo respect writeable flag.
Closes #4465.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/src/multiarray/item_selection.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/item_selection.c b/numpy/core/src/multiarray/item_selection.c index b2bf17f4c..cd0ae1680 100644 --- a/numpy/core/src/multiarray/item_selection.c +++ b/numpy/core/src/multiarray/item_selection.c @@ -265,6 +265,11 @@ PyArray_PutTo(PyArrayObject *self, PyObject* values0, PyObject *indices0, "put: first argument must be an array"); return NULL; } + + if (PyArray_FailUnlessWriteable(self, "put: output array") < 0) { + return NULL; + } + if (!PyArray_ISCONTIGUOUS(self)) { PyArrayObject *obj; int flags = NPY_ARRAY_CARRAY | NPY_ARRAY_UPDATEIFCOPY; |