Fix bug where ``nanops._has_infs`` doesn't work with many dtypes (issue #7357)

Fixes issue #7357, where where ``nanops._has_infs`` doesn't work with many dtypes