8000 better writeable flag fix by juliantaylor · Pull Request #4847 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

better writeable flag fix #4847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 6, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions numpy/core/src/multiarray/mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ array_boolean_subscript(PyArrayObject *self,
Py_INCREF(dtype);
ret = (PyArrayObject *)PyArray_NewFromDescr(Py_TYPE(self), dtype, 1,
&size, PyArray_STRIDES(ret), PyArray_BYTES(ret),
0, (PyObject *)self);
PyArray_FLAGS(self), (PyObject *)self);

if (ret == NULL) {
Py_DECREF(tmp);
Expand All @@ -1058,9 +1058,6 @@ array_boolean_subscript(PyArrayObject *self,
Py_DECREF(ret);
return NULL;
}
if (_IsWriteable(ret)) {
PyArray_ENABLEFLAGS(ret, NPY_ARRAY_WRITEABLE);
}
}

return ret;
Expand Down Expand Up @@ -1572,7 +1569,7 @@ array_subscript(PyArrayObject *self, PyObject *op)
PyArray_SHAPE(tmp_arr),
PyArray_STRIDES(tmp_arr),
PyArray_BYTES(tmp_arr),
0, /* TODO: Flags? */
PyArray_FLAGS(self),
(PyObject *)self);

if (result == NULL) {
Expand All @@ -1586,9 +1583,6 @@ array_subscript(PyArrayObject *self, PyObject *op)
result = NULL;
goto finish;
}
if (_IsWriteable(result)) {
PyArray_ENABLEFLAGS(result, NPY_ARRAY_WRITEABLE);
}
}

finish:
Expand Down Expand Up @@ -1813,7 +1807,8 @@ array_assign_subscript(PyArrayObject *self, PyObject *ind, PyObject *op)
* check to allow wrong dimensional boolean arrays in all cases.
*/
if (PyArray_NDIM(tmp_arr) > 1) {
if (attempt_1d_fallback(self, indices[0].object, tmp_arr) < 0) {
if (attempt_1d_fallback(self, indices[0].object,
(PyObject*)tmp_arr) < 0) {
goto fail;
}
goto success;
Expand Down
0