Antonio Cuni  committed 0805e1a

fix issue1000: None is an acceptable value for numpypy floats and has to be converted to NaN

  • Participants
  • Parent commits 74a2914

Comments (0)

Files changed (2)

File pypy/module/micronumpy/test/

         assert numpy.float64('23.4') == numpy.float64(23.4)
         raises(ValueError, numpy.float64, '23.2df')
+    def test_float_None(self):
+        import _numpypy as numpy
+        from math import isnan
+        assert isnan(numpy.float32(None))
+        assert isnan(numpy.float64(None))
+        assert isnan(numpy.float128(None))
     def test_longfloat(self):
         import _numpypy as numpy
         # it can be float96 or float128

File pypy/module/micronumpy/

     _mixin_ = True
     def _coerce(self, space, w_item):
+        if space.is_none(w_item):
+            return
         return, w_item)))
     def str_format(self, box):