diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2014-07-05 18:43:13 +0200 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2014-07-05 18:43:13 +0200 |
commit | ed88fa9615c43da364a641c741badd855729dd3c (patch) | |
tree | 779d31ceabe06e5142ab46e71c5ab1f0998ece14 /numpy | |
parent | 743448139a4bca50209854dd8a6ffac97feafd30 (diff) | |
download | numpy-ed88fa9615c43da364a641c741badd855729dd3c.tar.gz |
BUG: boolean assignment; allow wrong number of elements
Uses old code to be more broad then previous commit
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/mapping.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/numpy/core/src/multiarray/mapping.c b/numpy/core/src/multiarray/mapping.c index 9b9e6019c..8fb3aa369 100644 --- a/numpy/core/src/multiarray/mapping.c +++ b/numpy/core/src/multiarray/mapping.c @@ -1797,25 +1797,20 @@ array_assign_subscript(PyArrayObject *self, PyObject *ind, PyObject *op) tmp_arr = (PyArrayObject *)op; } - /* - * Deprecated case. The old boolean indexing seemed to have some - * check to allow wrong dimensional boolean arrays in all cases. - * Note that it did *not* allow a wrong number of elements here. - */ - if (PyArray_NDIM(tmp_arr) > 1) { - PyArrayObject *unraveled_tmp = tmp_arr; - if (DEPRECATE("boolean assignment blah blah.") < 0) { - goto fail; - } - tmp_arr = (PyArrayObject *)PyArray_Ravel(unraveled_tmp, NPY_CORDER); - Py_DECREF(unraveled_tmp); - if (tmp_arr == NULL) { - goto fail; - } - } if (array_assign_boolean_subscript(self, (PyArrayObject *)indices[0].object, tmp_arr, NPY_CORDER) < 0) { + /* + * Deprecated case. The old boolean indexing seemed to have some + * check to allow wrong dimensional boolean arrays in all cases. + * Note that it did *not* allow a wrong number of elements here. + */ + if (PyArray_NDIM(tmp_arr) > 1) { + if (attempt_1d_fallback(self, indices[0].object, tmp_arr) < 0) { + goto fail; + } + goto success; + } goto fail; } goto success; |