diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 3dc6aed56fa24..40699854ab0f3 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -601,7 +601,9 @@ def _dtype_to_subclass(cls, dtype: DtypeObj): # See each method's docstring. @classmethod - def _simple_new(cls: type[_IndexT], values, name: Hashable = None) -> _IndexT: + def _simple_new( + cls: type[_IndexT], values: ArrayLike, name: Hashable = None + ) -> _IndexT: """ We require that we have a dtype compat for the values. If we are passed a non-dtype compat, then coerce using the constructor. diff --git a/pandas/core/indexes/range.py b/pandas/core/indexes/range.py index 1937cd4254790..a9b35b99e4b51 100644 --- a/pandas/core/indexes/range.py +++ b/pandas/core/indexes/range.py @@ -167,8 +167,13 @@ def from_range( cls._validate_dtype(dtype) return cls._simple_new(data, name=name) + # error: Argument 1 of "_simple_new" is incompatible with supertype "Index"; + # supertype defines the argument type as + # "Union[ExtensionArray, ndarray[Any, Any]]" [override] @classmethod - def _simple_new(cls, values: range, name: Hashable = None) -> RangeIndex: + def _simple_new( # type: ignore[override] + cls, values: range, name: Hashable = None + ) -> RangeIndex: result = object.__new__(cls) assert isinstance(values, range)