diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-07-11 17:16:42 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-07-11 17:16:42 -0700 |
commit | a053a4372aba0af0bd63ffd5e207baf469cfc7bf (patch) | |
tree | afcdad0da5b29ce832528474246dcb66bc1491cf /numpy/core/machar.py | |
parent | e1c4806b649933383fb610205fb612c438360472 (diff) | |
parent | 2f1174dee44e901b7d028beb86f4a8ea324bd74f (diff) | |
download | numpy-a053a4372aba0af0bd63ffd5e207baf469cfc7bf.tar.gz |
Merge pull request #3518 from charris/use-errstate-context-manager
MAINT: Use np.errstate context manager.
Diffstat (limited to 'numpy/core/machar.py')
-rw-r--r-- | numpy/core/machar.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/numpy/core/machar.py b/numpy/core/machar.py index 85eb6b625..9eb4430a6 100644 --- a/numpy/core/machar.py +++ b/numpy/core/machar.py @@ -10,7 +10,7 @@ from __future__ import division, absolute_import, print_function __all__ = ['MachAr'] from numpy.core.fromnumeric import any -from numpy.core.numeric import seterr +from numpy.core.numeric import errstate # Need to speed this up...especially for longfloat @@ -107,11 +107,8 @@ class MachAr(object): """ # We ignore all errors here because we are purposely triggering # underflow to detect the properties of the runninng arch. - saverrstate = seterr(under='ignore') - try: + with errstate(under='ignore'): self._do_init(float_conv, int_conv, float_to_float, float_to_str, title) - finally: - seterr(**saverrstate) def _do_init(self, float_conv, int_conv, float_to_float, float_to_str, title): max_iterN = 10000 |