[NumPy-Tickets] [NumPy] #1587: Silence test warnings in numpy 1.5

NumPy Trac numpy-tickets@scipy....
Thu Aug 19 02:37:25 CDT 2010


#1587: Silence test warnings in numpy 1.5
---------------------------+------------------------------------------------
 Reporter:  cgohlke        |       Owner:  somebody
     Type:  enhancement    |      Status:  new     
 Priority:  normal         |   Milestone:  1.5.0   
Component:  numpy.testing  |     Version:          
 Keywords:                 |  
---------------------------+------------------------------------------------
 This issue was discussed at http://mail.scipy.org/pipermail/numpy-
 discussion/2010-August/052283.html

 NumPy 1.5.0 beta 2 built with msvc9/mkl for Python 2.6, 2.7 and 3.1 (32
 and 64 bit) reports many (> 200) warnings.

 The warnings are of the type "Warning: invalid value encountered in" for
 the functions reduce, fmax, fmin, logaddexp, maximum, greater, less_equal,
 greater_equal, absolute, and others.

 When using MSVC compilers, ordered comparisons involving NaN raise an
 exception [1], i.e. set the 'invalid' x87 status bit.

 The attached patch silences those warnings during the numpy tests. It
 basically wraps the warning emitting code into:

 {{{
 err = np.seterr(invalid='raise')
 try:
     ...
 finally:
     np.seterr(**err)
 }}}

 The patch also silences the "divide by zero encountered in log" warning in
 the masked array module tests. This warning is also observed on other
 platforms.

 [1] http://msdn.microsoft.com/en-us/library/e7s85ffb%28v=VS.90%29.aspx

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1587>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list