Commit 37d13c94 authored by Mark's avatar Mark

Merge pull request #122 from geggo/master

fixes typo in memory view validation code
parents ae453c85 d6d492cf
...@@ -163,7 +163,7 @@ static int __Pyx_ValidateAndInit_memviewslice( ...@@ -163,7 +163,7 @@ static int __Pyx_ValidateAndInit_memviewslice(
struct __pyx_memoryview_obj *memview, *new_memview; struct __pyx_memoryview_obj *memview, *new_memview;
__Pyx_RefNannyDeclarations __Pyx_RefNannyDeclarations
Py_buffer *buf; Py_buffer *buf;
int stride, i, spec = 0, retval = -1; int i, spec = 0, retval = -1;
__Pyx_BufFmt_Context ctx; __Pyx_BufFmt_Context ctx;
int from_memoryview = __pyx_memoryview_check(original_obj); int from_memoryview = __pyx_memoryview_check(original_obj);
...@@ -261,7 +261,7 @@ static int __Pyx_ValidateAndInit_memviewslice( ...@@ -261,7 +261,7 @@ static int __Pyx_ValidateAndInit_memviewslice(
} }
if (c_or_f_flag & __Pyx_IS_F_CONTIG) { if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
stride = 1; Py_ssize_t stride = 1;
for(i=0; i<ndim; i++) { for(i=0; i<ndim; i++) {
if(stride * buf->itemsize != buf->strides[i]) { if(stride * buf->itemsize != buf->strides[i]) {
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
...@@ -270,7 +270,8 @@ static int __Pyx_ValidateAndInit_memviewslice( ...@@ -270,7 +270,8 @@ static int __Pyx_ValidateAndInit_memviewslice(
} }
stride = stride * buf->shape[i]; stride = stride * buf->shape[i];
} }
} else if (c_or_f_flag & __Pyx_IS_F_CONTIG) { } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
Py_ssize_t stride = 1;
for(i=ndim-1; i>-1; i--) { for(i=ndim-1; i>-1; i--) {
if(stride * buf->itemsize != buf->strides[i]) { if(stride * buf->itemsize != buf->strides[i]) {
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment