summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/src/multiarray/buffer.c12
-rwxr-xr-xtools/travis-test.sh2
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