[NumPy-Tickets] [NumPy] #1877: Incorrect RuntimeWarning on first call to numpy.where

NumPy Trac numpy-tickets@scipy....
Tue Jun 21 15:29:58 CDT 2011


#1877: Incorrect RuntimeWarning on first call to numpy.where
---------------------------------------------------+------------------------
 Reporter:  deil                                   |       Owner:  somebody
     Type:  defect                                 |      Status:  new     
 Priority:  normal                                 |   Milestone:  1.6.1   
Component:  Other                                  |     Version:  1.6.0   
 Keywords:  where, RuntimeWarning, log, incorrect  |  
---------------------------------------------------+------------------------
 On my Mac OS 10.6 with python 2.7 and numpy 1.6.0 installed via macports I
 get the following RunTimeWarning on the first call to numpy.where, but not
 on
 subsequent calls:

 {{{
 $ python
 Python 2.7.1 (r271:86832, May 15 2011, 23:17:21)
 [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy as np
 >>> np.where([False, True],np.log([0, 1]), 42)
 __main__:1: RuntimeWarning: divide by zero encountered in log
 array([ 42.,   0.])
 >>> np.where([False, True],np.log([0, 1]), 42)
 array([ 42.,   0.])
 >>> np.__version__
 '1.6.0'
 }}}

 This warning occurs when calling np.log(0), which here shouldn't have been
 invoked, right?
 On a Linux box I have I don't get the warning using the same commands.

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


More information about the NumPy-Tickets mailing list