@@ -968,19 +968,10 @@ def fast_xs(self, loc: int) -> SingleBlockManager:
968
968
969
969
n = len (self )
970
970
971
- # GH#46406
972
- immutable_ea = isinstance (dtype , ExtensionDtype ) and dtype ._is_immutable
973
-
974
- if isinstance (dtype , ExtensionDtype ) and not immutable_ea :
975
- cls = dtype .construct_array_type ()
976
- result = cls ._empty ((n ,), dtype = dtype )
971
+ if isinstance (dtype , ExtensionDtype ):
972
+ result = np .empty (n , dtype = object )
977
973
else :
978
- # error: Argument "dtype" to "empty" has incompatible type
979
- # "Union[Type[object], dtype[Any], ExtensionDtype, None]"; expected
980
- # "None"
981
- result = np .empty (
982
- n , dtype = object if immutable_ea else dtype # type: ignore[arg-type]
983
- )
974
+ result = np .empty (n , dtype = dtype )
984
975
result = ensure_wrapped_if_datetimelike (result )
985
976
986
977
for blk in self .blocks :
@@ -989,9 +980,9 @@ def fast_xs(self, loc: int) -> SingleBlockManager:
989
980
for i , rl in enumerate (blk .mgr_locs ):
990
981
result [rl ] = blk .iget ((i , loc ))
991
982
992
- if immutable_ea :
993
- dtype = cast ( ExtensionDtype , dtype )
994
- result = dtype . construct_array_type () ._from_sequence (result , dtype = dtype )
983
+ if isinstance ( dtype , ExtensionDtype ) :
984
+ cls = dtype . construct_array_type ( )
985
+ result = cls ._from_sequence (result , dtype = dtype )
995
986
996
987
bp = BlockPlacement (slice (0 , len (result )))
997
988
block = new_block (result , placement = bp , ndim = 1 )
0 commit comments