Skip to content

Questionable behaviour in MaskedArray.__eq__ on flexible arrays #8589

@eric-wieser

Description

@eric-wieser

These lines, introduced in a5da87c by @pierregm, appear multiple times in numpy/ma/core.py, such as MaskedArray.__eq__:

try:
    mask = mask.view((bool_, len(self.dtype))).all(axis)
except ValueError:
    mask = np.all([[f[n].all() for n in mask.dtype.names]
      for f in mask], axis=axis)

But where is this ValueError expected to come from? The .view, or the .all, due to an invalid axis.

It seems like there is a bug in the code that prepares axis here, and this bug is being silenced by an overzealous try/catch.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions