@@ -508,7 +508,8 @@ def _validate_shift_value(self, fill_value):
508508 )
509509 fill_value = new_fill
510510
511- return self ._unbox (fill_value )
511+ rv = self ._unbox (fill_value )
512+ return self ._rebox_native (rv )
512513
513514 def _validate_scalar (self , value , msg : Optional [str ] = None ):
514515 """
@@ -603,18 +604,15 @@ def _validate_setitem_value(self, value):
603604 else :
604605 value = self ._validate_scalar (value , msg )
605606
606- return self ._unbox (value , setitem = True )
607+ rv = self ._unbox (value , setitem = True )
608+ return self ._rebox_native (rv )
607609
608610 def _validate_insert_value (self , value ):
609611 msg = f"cannot insert { type (self ).__name__ } with incompatible label"
610612 value = self ._validate_scalar (value , msg )
611613
612- self ._check_compatible_with (value , setitem = True )
613- # TODO: if we dont have compat, should we raise or astype(object)?
614- # PeriodIndex does astype(object)
615- return value
616- # Note: we do not unbox here because the caller needs boxed value
617- # to check for freq.
614+ rv = self ._unbox (value , setitem = True )
615+ return self ._rebox_native (rv )
618616
619617 def _validate_where_value (self , other ):
620618 msg = f"Where requires matching dtype, not { type (other )} "
@@ -623,7 +621,8 @@ def _validate_where_value(self, other):
623621 else :
624622 other = self ._validate_listlike (other )
625623
626- return self ._unbox (other , setitem = True )
624+ rv = self ._unbox (other , setitem = True )
625+ return self ._rebox_native (rv )
627626
628627 def _unbox (self , other , setitem : bool = False ) -> Union [np .int64 , np .ndarray ]:
629628 """
0 commit comments