10000 BUG: Make PyArray_PutTo respect writeable flag. · numpy/numpy@892c469 · GitHub
[go: up one dir, main page]

Skip to content

Commit 892c469

Browse files
jarl-haggertycharris
authored andcommitted
BUG: Make PyArray_PutTo respect writeable flag.
Closes #4465.
1 parent 2f1e276 commit 892c469

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

numpy/core/src/multiarray/item_selection.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@ PyArray_PutTo(PyArrayObject *self, PyObject* values0, PyObject *indices0,
265265
"put: first argument must be an array");
266266
return NULL;
267267
}
268+
269+
if (PyArray_FailUnlessWriteable(self, "put: output array") < 0) {
270+
return NULL;
271+
}
272+
268273
if (!PyArray_ISCONTIGUOUS(self)) {
269274
PyArrayObject *obj;
270275
int flags = NPY_ARRAY_CARRAY | NPY_ARRAY_UPDATEIFCOPY;

0 commit comments

Comments
 (0)
0