[Numpy-discussion] Release blockers for 1.4.0 ?

Robert Kern robert.kern at gmail.com
Tue Dec 8 16:36:41 EST 2009


On Tue, Dec 8, 2009 at 15:25, Pierre GM <pgmdevlist at gmail.com> wrote:
> On Dec 8, 2009, at 12:54 PM, Robert Kern wrote:
>>
>> As far as I can tell, the faulty global seterr() has been in place
>> since 1.1.0, so fixing it at all should be considered a feature
>> change. It's not likely to actually *break* things except for doctests
>> and documentation. I think I fall in with Chuck in suggesting that it
>> should be changed in 1.5.0.
>
> OK. I'll work on fixing the remaining issues when a np function is applied on a masked array.
>
> FYI. most of the warnings can be fixed in _MaskedUnaryOperation and consorts with:
>
>        err_status_ini = np.geterr()
>        np.seterr(divide='ignore', invalid='ignore')
>        result = self.f(da, db, *args, **kwargs)
>        np.seterr(**err_status_ini)
>
> Is this kind of fix acceptable ?

  olderr = np.seterr(divide='ignore', invalid='ignore')
  try:
    result = self.f(da, db, *args, **kwargs)
  finally:
    np.seterr(**olderr)

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco



More information about the NumPy-Discussion mailing list