diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2015-11-26 08:55:06 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2015-11-26 08:55:06 -0700 |
commit | dac0e5d70e397857ea7d6cf10975de582003a82f (patch) | |
tree | 7e95c22fa978f0f0c892e181cc309f0b420751cb | |
parent | 53e658f80da6a50d371c74f49d3bb81fabf20d1b (diff) | |
parent | 6711d17a529c79b71397b48167b009f8dbf41985 (diff) | |
download | python-numpy-dac0e5d70e397857ea7d6cf10975de582003a82f.tar.gz python-numpy-dac0e5d70e397857ea7d6cf10975de582003a82f.tar.bz2 python-numpy-dac0e5d70e397857ea7d6cf10975de582003a82f.zip |
Merge pull request #6726 from charris/fix-bugs-exposed-by-relaxed-stride-rollback
Fix bugs exposed by relaxed stride rollback
-rw-r--r-- | numpy/core/src/multiarray/buffer.c | 12 | ||||
-rwxr-xr-x | tools/travis-test.sh | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/numpy/core/src/multiarray/buffer.c b/numpy/core/src/multiarray/buffer.c index 7f7607e1f..5fa3ba95b 100644 --- a/numpy/core/src/multiarray/buffer.c +++ b/numpy/core/src/multiarray/buffer.c @@ -629,8 +629,6 @@ array_getbuffer(PyObject *obj, Py_buffer *view, int flags) { PyArrayObject *self; _buffer_info_t *info = NULL; - int i; - Py_ssize_t sd; self = (PyArrayObject*)obj; @@ -715,15 +713,19 @@ array_getbuffer(PyObject *obj, Py_buffer *view, int flags) * regenerate strides from shape. */ if (PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS) && - !((flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS)) { - sd = view->itemsize; + !((flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS)) { + Py_ssize_t sd = view->itemsize; + int i; + for (i = view->ndim-1; i >= 0; --i) { view->strides[i] = sd; sd *= view->shape[i]; } } else if (PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)) { - sd = view->itemsize; + Py_ssize_t sd = view->itemsize; + int i; + for (i = 0; i < view->ndim; ++i) { view->strides[i] = sd; sd *= view->shape[i]; diff --git a/tools/travis-test.sh b/tools/travis-test.sh index 818d0cf41..795915d0b 100755 --- a/tools/travis-test.sh +++ b/tools/travis-test.sh @@ -100,7 +100,7 @@ if [ -n "$USE_WHEEL" ] && [ $# -eq 0 ]; then . venv-for-wheel/bin/activate # Move out of source directory to avoid finding local numpy pushd dist - $PIP install --pre --upgrade --find-links . numpy + $PIP install --pre --no-index --upgrade --find-links=. numpy $PIP install nose popd run_test |