Skip to content

Commit

Permalink
BUG: Replace ISFORTRAN by IS_F_CONTIGUOUS.
Browse files Browse the repository at this point in the history
In a few places ISFORTRAN was used to check for f-contiguouity.
This is incorrect, since ISFORTRAN never evaluated to True if
the array was also c-contiguous.
  • Loading branch information
seberg committed Oct 21, 2012
1 parent 4b28147 commit 0e10f55
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions numpy/core/src/multiarray/convert.c
Expand Up @@ -265,8 +265,8 @@ PyArray_ToString(PyArrayObject *self, NPY_ORDER order)
*/

numbytes = PyArray_NBYTES(self);
if ((PyArray_ISCONTIGUOUS(self) && (order == NPY_CORDER))
|| (PyArray_ISFORTRAN(self) && (order == NPY_FORTRANORDER))) {
if ((PyArray_IS_C_CONTIGUOUS(self) && (order == NPY_CORDER))
|| (PyArray_IS_F_CONTIGUOUS(self) && (order == NPY_FORTRANORDER))) {
ret = PyBytes_FromStringAndSize(PyArray_DATA(self), (Py_ssize_t) numbytes);
}
else {
Expand Down
4 changes: 2 additions & 2 deletions numpy/core/src/multiarray/multiarraymodule.c
Expand Up @@ -1566,8 +1566,8 @@ _prepend_ones(PyArrayObject *arr, int nd, int ndmin, NPY_ORDER order)
#define STRIDING_OK(op, order) \
((order) == NPY_ANYORDER || \
(order) == NPY_KEEPORDER || \
((order) == NPY_CORDER && PyArray_ISCONTIGUOUS(op)) || \
((order) == NPY_FORTRANORDER && PyArray_ISFORTRAN(op)))
((order) == NPY_CORDER && PyArray_IS_C_CONTIGUOUS(op)) || \
((order) == NPY_FORTRANORDER && PyArray_IS_F_CONTIGUOUS(op)))

static PyObject *
_array_fromobject(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *kws)
Expand Down
4 changes: 2 additions & 2 deletions numpy/core/src/multiarray/shape.c
Expand Up @@ -1015,10 +1015,10 @@ PyArray_Ravel(PyArrayObject *arr, NPY_ORDER order)
}
}

if (order == NPY_CORDER && PyArray_ISCONTIGUOUS(arr)) {
if (order == NPY_CORDER && PyArray_IS_C_CONTIGUOUS(arr)) {
return PyArray_Newshape(arr, &newdim, NPY_CORDER);
}
else if (order == NPY_FORTRANORDER && PyArray_ISFORTRAN(arr)) {
else if (order == NPY_FORTRANORDER && PyArray_IS_F_CONTIGUOUS(arr)) {
return PyArray_Newshape(arr, &newdim, NPY_FORTRANORDER);
}
/* For KEEPORDER, check if we can make a flattened view */
Expand Down

0 comments on commit 0e10f55

Please sign in to comment.