Skip to content

Commit

Permalink
Merge pull request numpy#4847 from juliantaylor/writeable2
Browse files Browse the repository at this point in the history
better writeable flag fix
  • Loading branch information
charris committed Jul 6, 2014
2 parents 1c71d46 + 4352957 commit d244ec7
Showing 1 changed file with 4 additions and 9 deletions.
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 comments on commit d244ec7

Please sign in to comment.