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