@@ -361,6 +361,11 @@ def reduce(self, func) -> list[Block]:
361361 else :
362362 res_values = result .reshape (- 1 , 1 )
363363
364+ if self .values .dtype == object :
365+ if res_values .dtype .kind == "f" :
366+ # TODO: this is kludgy; does it mean there is a problem
367+ # at a higher level?
368+ res_values = res_values .astype (object )
364369 nb = self .make_block (res_values )
365370 return [nb ]
366371
@@ -2226,6 +2231,8 @@ def new_block_2d(
22262231 klass = get_block_type (values .dtype )
22272232
22282233 values = maybe_coerce_values (values )
2234+ if isinstance (values , np .ndarray ):
2235+ assert values .dtype == np .float16 or values .dtype .kind not in "iufb"
22292236 return klass (values , ndim = 2 , placement = placement , refs = refs )
22302237
22312238
@@ -2241,6 +2248,8 @@ def new_block(
22412248 # - check_ndim/ensure_block_shape already checked
22422249 # - maybe_coerce_values already called/unnecessary
22432250 klass = get_block_type (values .dtype )
2251+ if isinstance (values , np .ndarray ):
2252+ assert values .dtype == np .float16 or values .dtype .kind not in "iufb"
22442253 return klass (values , ndim = ndim , placement = placement , refs = refs )
22452254
22462255
0 commit comments