diff options
Diffstat (limited to 'numpy/testing/utils.py')
-rw-r--r-- | numpy/testing/utils.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py index f7fbbc2cb..745398dc3 100644 --- a/numpy/testing/utils.py +++ b/numpy/testing/utils.py @@ -61,10 +61,14 @@ def gisfinite(x): exception is always raised. This should be removed once this problem is solved at the Ufunc level.""" - from numpy.core import isfinite - st = isfinite(x) - if isinstance(st, types.NotImplementedType): - raise TypeError("isfinite not supported for this type") + from numpy.core import isfinite, seterr + err = seterr(invalid='ignore') + try: + st = isfinite(x) + if isinstance(st, types.NotImplementedType): + raise TypeError("isfinite not supported for this type") + finally: + seterr(**err) return st def gisinf(x): @@ -78,10 +82,14 @@ def gisinf(x): exception is always raised. This should be removed once this problem is solved at the Ufunc level.""" - from numpy.core import isinf - st = isinf(x) - if isinstance(st, types.NotImplementedType): - raise TypeError("isinf not supported for this type") + from numpy.core import isinf, seterr + err = seterr(invalid='ignore') + try: + st = isinf(x) + if isinstance(st, types.NotImplementedType): + raise TypeError("isinf not supported for this type") + finally: + seterr(**err) return st def rand(*args): |