diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-10-19 15:18:55 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-10-19 15:18:55 +0000 |
commit | ab5a8a2d2d019c4962cd08b0b37b5d48b63ec880 (patch) | |
tree | 2a50ac4e32fb1a16265dc5d962afaecaabcd8c52 /numpy | |
parent | bea2f1c00930442aeaaa5c227f6458ff5067f3d1 (diff) | |
download | numpy-ab5a8a2d2d019c4962cd08b0b37b5d48b63ec880.tar.gz |
Fix longfloat test on platforms where they are the same as doubles. Add ability to set error call-back/logging-object in errstate object.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/numeric.py | 6 | ||||
-rw-r--r-- | numpy/core/tests/test_regression.py | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 8ac6ff726..0f6f02eed 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -781,11 +781,17 @@ class errstate(object): # Note that we don't want to run the above doctests because they will fail # without a from __future__ import with_statement def __init__(self, **kwargs): + try: + self.errcall = kwargs.pop('errcall') + except KeyError: + self.errcall = None self.kwargs = kwargs def __enter__(self): self.oldstate = seterr(**self.kwargs) + self.oldcall = seterrcall(self.errcall) def __exit__(self, *exc_info): seterr(**self.oldstate) + seterrcall(self.oldcall) def _setdef(): defval = [UFUNC_BUFSIZE_DEFAULT, ERR_DEFAULT2, None] diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py index 9dfc31183..58b4c4459 100644 --- a/numpy/core/tests/test_regression.py +++ b/numpy/core/tests/test_regression.py @@ -215,8 +215,9 @@ class test_regression(NumpyTestCase): def check_longfloat_repr(self,level=rlevel): """Ticket #112""" - a = N.exp(N.array([1000],dtype=N.longfloat)) - assert(str(a)[1:9] == str(a[0])[:8]) + if N.longfloat(0).itemsize > 8: + a = N.exp(N.array([1000],dtype=N.longfloat)) + assert(str(a)[1:9] == str(a[0])[:8]) def check_argmax(self,level=rlevel): """Ticket #119""" |