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.