BUG: Fixes #5376: np.ravel to return same array type

See commit message for details.
I'd omit the parenthesis around "or...".