diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 47e3314c6d9c3..7a8e030b2d536 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -738,7 +738,12 @@ def _with_infer(cls, *args, **kwargs): return result @cache_readonly - def _constructor(self: _IndexT) -> type[_IndexT]: + def _constructor( + self: _IndexT, + name: Hashable | None = None, + copy: bool | None = None, + dtype=None, + ) -> type[_IndexT]: return type(self) @final diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index 574dfdf48055d..66c3d15676c5a 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -1148,7 +1148,12 @@ def _engine(self): # Return type "Callable[..., MultiIndex]" of "_constructor" incompatible with return # type "Type[MultiIndex]" in supertype "Index" @property - def _constructor(self) -> Callable[..., MultiIndex]: # type: ignore[override] + def _constructor( + self: MultiIndex, + name: Hashable | None = None, + copy: bool | None = None, + dtype=None, + ) -> Callable[..., MultiIndex]: # type: ignore[override] return type(self).from_tuples @doc(Index._shallow_copy) diff --git a/pandas/core/indexes/range.py b/pandas/core/indexes/range.py index 0948c5a3825d0..41ab0125c5014 100644 --- a/pandas/core/indexes/range.py +++ b/pandas/core/indexes/range.py @@ -188,7 +188,12 @@ def _simple_new(cls, values: range, name: Hashable = None) -> RangeIndex: # error: Return type "Type[Int64Index]" of "_constructor" incompatible with return # type "Type[RangeIndex]" in supertype "Index" @cache_readonly - def _constructor(self) -> type[Int64Index]: # type: ignore[override] + def _constructor( + self: RangeIndex, + name: Hashable | None = None, + copy: bool | None = None, + dtype=None + ) -> type[Int64Index]: # type: ignore[override] """return the class to use for construction""" return Int64Index