def gisfinite(x):
from numpy.core import isfinite, errstate<EOL>with errstate(invalid='<STR_LIT:ignore>'):<EOL><INDENT>st = isfinite(x)<EOL>if isinstance(st, type(NotImplemented)):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT><DEDENT>return st<EOL>
like isfinite, but always raise an error if type not supported instead of
    returning a TypeError object.

    Notes
    -----
    isfinite and other ufunc sometimes return a NotImplementedType object instead
    of raising any exception. This function is a wrapper to make sure an
    exception is always raised.

    This should be removed once this problem is solved at the Ufunc level.