@@ -3328,6 +3328,10 @@ def _scalar_heuristic(arr, elem):
33283328 # Note: Don't try to check for m.any(), that'll take too long
33293329 return dout
33303330
3331+ # setitem may put NaNs into integer arrays or occasionally overflow a
3332+ # float. But this may happen in masked values, so avoid otherwise
3333+ # correct warnings (as is typical also in masked calculations).
3334+ @np .errstate (over = 'ignore' , invalid = 'ignore' )
33313335 def __setitem__ (self , indx , value ):
33323336 """
33333337 x.__setitem__(i, y) <==> x[i]=y
@@ -4619,6 +4623,7 @@ def ravel(self, order='C'):
46194623 otherwise. 'K' means to read the elements in the order they occur
46204624 in memory, except for reversing the data when strides are negative.
46214625 By default, 'C' index order is used.
4626+ (Masked arrays currently use 'A' on the data when 'K' is passed.)
46224627
46234628 Returns
46244629 -------
@@ -4645,6 +4650,13 @@ def ravel(self, order='C'):
46454650 fill_value=999999)
46464651
46474652 """
4653+ # The order of _data and _mask could be different (it shouldn't be
4654+ # normally). Passing order `K` or `A` would be incorrect.
4655+ # So we ignore the mask memory order.
4656+ # TODO: We don't actually support K, so use A instead. We could
4657+ # try to guess this correct by sorting strides or deprecate.
4658+ if order in "kKaA" :
4659+ order = "C" if self ._data .flags .fnc else "F"
46484660 r = ndarray .ravel (self ._data , order = order ).view (type (self ))
46494661 r ._update_from (self )
46504662 if self ._mask is not nomask :
0 commit comments