Skip to content

Commit d524bcb

Browse files
committed
Mark some types as non-hashable
Based on @JelleZijlstra's PR python#2221. Fixes python#2148
1 parent b94fa84 commit d524bcb

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

stdlib/2/__builtin__.pyi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ class bytearray(MutableSequence[int], ByteString):
734734
def __repr__(self) -> str: ...
735735
def __int__(self) -> int: ...
736736
def __float__(self) -> float: ...
737-
def __hash__(self) -> int: ...
737+
__hash__: None # type: ignore
738738
@overload
739739
def __getitem__(self, i: int) -> int: ...
740740
@overload
@@ -849,6 +849,7 @@ class slice(object):
849849
def __init__(self, stop: Any) -> None: ...
850850
@overload
851851
def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ...
852+
__hash__: None # type: ignore
852853
def indices(self, len: int) -> Tuple[int, int, int]: ...
853854

854855
class tuple(Sequence[_T_co], Generic[_T_co]):
@@ -906,7 +907,7 @@ class list(MutableSequence[_T], Generic[_T]):
906907
def __len__(self) -> int: ...
907908
def __iter__(self) -> Iterator[_T]: ...
908909
def __str__(self) -> str: ...
909-
def __hash__(self) -> int: ...
910+
__hash__: None # type: ignore
910911
@overload
911912
def __getitem__(self, i: int) -> _T: ...
912913
@overload
@@ -980,6 +981,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
980981
def __delitem__(self, v: _KT) -> None: ...
981982
def __iter__(self) -> Iterator[_KT]: ...
982983
def __str__(self) -> str: ...
984+
__hash__: None # type: ignore
983985

984986
class set(MutableSet[_T], Generic[_T]):
985987
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
@@ -1016,6 +1018,7 @@ class set(MutableSet[_T], Generic[_T]):
10161018
def __lt__(self, s: AbstractSet[object]) -> bool: ...
10171019
def __ge__(self, s: AbstractSet[object]) -> bool: ...
10181020
def __gt__(self, s: AbstractSet[object]) -> bool: ...
1021+
__hash__: None # type: ignore
10191022

10201023
class frozenset(AbstractSet[_T], Generic[_T]):
10211024
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...

stdlib/2and3/builtins.pyi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ class bytearray(MutableSequence[int], ByteString):
734734
def __repr__(self) -> str: ...
735735
def __int__(self) -> int: ...
736736
def __float__(self) -> float: ...
737-
def __hash__(self) -> int: ...
737+
__hash__: None # type: ignore
738738
@overload
739739
def __getitem__(self, i: int) -> int: ...
740740
@overload
@@ -849,6 +849,7 @@ class slice(object):
849849
def __init__(self, stop: Any) -> None: ...
850850
@overload
851851
def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ...
852+
__hash__: None # type: ignore
852853
def indices(self, len: int) -> Tuple[int, int, int]: ...
853854

854855
class tuple(Sequence[_T_co], Generic[_T_co]):
@@ -906,7 +907,7 @@ class list(MutableSequence[_T], Generic[_T]):
906907
def __len__(self) -> int: ...
907908
def __iter__(self) -> Iterator[_T]: ...
908909
def __str__(self) -> str: ...
909-
def __hash__(self) -> int: ...
910+
__hash__: None # type: ignore
910911
@overload
911912
def __getitem__(self, i: int) -> _T: ...
912913
@overload
@@ -980,6 +981,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
980981
def __delitem__(self, v: _KT) -> None: ...
981982
def __iter__(self) -> Iterator[_KT]: ...
982983
def __str__(self) -> str: ...
984+
__hash__: None # type: ignore
983985

984986
class set(MutableSet[_T], Generic[_T]):
985987
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
@@ -1016,6 +1018,7 @@ class set(MutableSet[_T], Generic[_T]):
10161018
def __lt__(self, s: AbstractSet[object]) -> bool: ...
10171019
def __ge__(self, s: AbstractSet[object]) -> bool: ...
10181020
def __gt__(self, s: AbstractSet[object]) -> bool: ...
1021+
__hash__: None # type: ignore
10191022

10201023
class frozenset(AbstractSet[_T], Generic[_T]):
10211024
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...

0 commit comments

Comments
 (0)