[Numpy-svn] r3367 - in trunk/numpy/core: . tests

numpy-svn at scipy.org numpy-svn at scipy.org
Thu Oct 19 10:19:00 CDT 2006


Author: oliphant
Date: 2006-10-19 10:18:55 -0500 (Thu, 19 Oct 2006)
New Revision: 3367

Modified:
   trunk/numpy/core/numeric.py
   trunk/numpy/core/tests/test_regression.py
Log:
Fix longfloat test on platforms where they are the same as doubles.  Add ability to set error call-back/logging-object in errstate object.

Modified: trunk/numpy/core/numeric.py
===================================================================
--- trunk/numpy/core/numeric.py	2006-10-19 14:36:44 UTC (rev 3366)
+++ trunk/numpy/core/numeric.py	2006-10-19 15:18:55 UTC (rev 3367)
@@ -781,11 +781,17 @@
     # 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]

Modified: trunk/numpy/core/tests/test_regression.py
===================================================================
--- trunk/numpy/core/tests/test_regression.py	2006-10-19 14:36:44 UTC (rev 3366)
+++ trunk/numpy/core/tests/test_regression.py	2006-10-19 15:18:55 UTC (rev 3367)
@@ -215,8 +215,9 @@
 
     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"""



More information about the Numpy-svn mailing list