From 15428ec3f5a843d780b55049bc7222e8385cae22 Mon Sep 17 00:00:00 2001 From: bersbersbers <12128514+bersbersbers@users.noreply.github.com> Date: Thu, 17 Oct 2024 08:30:51 +0200 Subject: [PATCH] `slice` is hashable starting with Python 3.12 --- stdlib/builtins.pyi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 8a4a9829c892..fee4ccc5023c 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -948,7 +948,10 @@ class slice: @overload def __new__(cls, start: Any, stop: Any, step: Any = ..., /) -> Self: ... def __eq__(self, value: object, /) -> bool: ... - __hash__: ClassVar[None] # type: ignore[assignment] + if sys.version_info >= (3, 12): + def __hash__(self) -> int: ... + else: + __hash__: ClassVar[None] # type: ignore[assignment] def indices(self, len: SupportsIndex, /) -> tuple[int, int, int]: ... class tuple(Sequence[_T_co]):