Skip to content

Unexpected resetting of flags when using newaxis #4360

@insertinterestingnamehere

Description

When using np.newaxis, the array flags of the new array are set to say that the array is not C or Fortran contiguous, even when it should be.

For example:

import numpy as np
from numpy.random import rand
# Make an array that is C contiguous and F contiguous
A = rand(10)
A2 = A[...,np.newaxis]
print A2.flags

The flags are shown to be

C_CONTIGUOUS : False
F_CONTIGUOUS : False
OWNDATA : False
WRITEABLE : True
ALIGNED : True
UPDATEIFCOPY : False

Even though the actual memory layout of the array is both C and Fortran contiguous.

I can verify that this behavior appears on Linux and Windows installations of NumPy 1.8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions