Skip to content

[WIP] mark some types as non-hashable #2221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion stdlib/2/__builtin__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ class bytearray(MutableSequence[int]):
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __hash__(self) -> int: ...
__hash__: None
@overload
def __getitem__(self, i: int) -> int: ...
@overload
Expand Down Expand Up @@ -513,6 +513,7 @@ class slice(object):
@overload
def __init__(self, start: Optional[int], stop: Optional[int], step: Optional[int] = ...) -> None: ...
def indices(self, len: int) -> Tuple[int, int, int]: ...
__hash__: None

class tuple(Sequence[_T_co], Generic[_T_co]):
def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ...
Expand Down Expand Up @@ -579,6 +580,7 @@ class list(MutableSequence[_T], Generic[_T]):
def __ge__(self, x: List[_T]) -> bool: ...
def __lt__(self, x: List[_T]) -> bool: ...
def __le__(self, x: List[_T]) -> bool: ...
__hash__: None

class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
# NOTE: Keyword arguments are special. If they are used, _KT must include
Expand Down Expand Up @@ -621,6 +623,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __delitem__(self, v: _KT) -> None: ...
def __iter__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
__hash__: None

class set(MutableSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
Expand Down Expand Up @@ -657,6 +660,7 @@ class set(MutableSet[_T], Generic[_T]):
def __lt__(self, s: AbstractSet[object]) -> bool: ...
def __ge__(self, s: AbstractSet[object]) -> bool: ...
def __gt__(self, s: AbstractSet[object]) -> bool: ...
__hash__: None

class frozenset(AbstractSet[_T], Generic[_T]):
@overload
Expand Down
6 changes: 5 additions & 1 deletion stdlib/2/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ class bytearray(MutableSequence[int]):
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __hash__(self) -> int: ...
__hash__: None
@overload
def __getitem__(self, i: int) -> int: ...
@overload
Expand Down Expand Up @@ -513,6 +513,7 @@ class slice(object):
@overload
def __init__(self, start: Optional[int], stop: Optional[int], step: Optional[int] = ...) -> None: ...
def indices(self, len: int) -> Tuple[int, int, int]: ...
__hash__: None

class tuple(Sequence[_T_co], Generic[_T_co]):
def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ...
Expand Down Expand Up @@ -579,6 +580,7 @@ class list(MutableSequence[_T], Generic[_T]):
def __ge__(self, x: List[_T]) -> bool: ...
def __lt__(self, x: List[_T]) -> bool: ...
def __le__(self, x: List[_T]) -> bool: ...
__hash__: None

class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
# NOTE: Keyword arguments are special. If they are used, _KT must include
Expand Down Expand Up @@ -621,6 +623,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __delitem__(self, v: _KT) -> None: ...
def __iter__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
__hash__: None

class set(MutableSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
Expand Down Expand Up @@ -657,6 +660,7 @@ class set(MutableSet[_T], Generic[_T]):
def __lt__(self, s: AbstractSet[object]) -> bool: ...
def __ge__(self, s: AbstractSet[object]) -> bool: ...
def __gt__(self, s: AbstractSet[object]) -> bool: ...
__hash__: None

class frozenset(AbstractSet[_T], Generic[_T]):
@overload
Expand Down
7 changes: 5 additions & 2 deletions stdlib/3/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,6 @@ class bytearray(MutableSequence[int], ByteString):
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __hash__(self) -> int: ...
@overload
def __getitem__(self, i: int) -> int: ...
@overload
Expand All @@ -513,6 +512,7 @@ class bytearray(MutableSequence[int], ByteString):
def __le__(self, x: bytes) -> bool: ...
def __gt__(self, x: bytes) -> bool: ...
def __ge__(self, x: bytes) -> bool: ...
__hash__: None

class memoryview(Sized, Container[bytes]):
format = ... # type: str
Expand Down Expand Up @@ -583,6 +583,7 @@ class slice:
@overload
def __init__(self, start: Optional[int], stop: Optional[int], step: Optional[int] = ...) -> None: ...
def indices(self, len: int) -> Tuple[int, int, int]: ...
__hash__: None

class tuple(Sequence[_T_co], Generic[_T_co]):
def __new__(cls: Type[_T], iterable: Iterable[_T_co] = ...) -> _T: ...
Expand Down Expand Up @@ -635,7 +636,6 @@ class list(MutableSequence[_T], Generic[_T]):
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
def __hash__(self) -> int: ...
@overload
def __getitem__(self, i: int) -> _T: ...
@overload
Expand All @@ -656,6 +656,7 @@ class list(MutableSequence[_T], Generic[_T]):
def __ge__(self, x: List[_T]) -> bool: ...
def __lt__(self, x: List[_T]) -> bool: ...
def __le__(self, x: List[_T]) -> bool: ...
__hash__: None

class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
# NOTE: Keyword arguments are special. If they are used, _KT must include
Expand Down Expand Up @@ -694,6 +695,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __delitem__(self, v: _KT) -> None: ...
def __iter__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
__hash__: None

class set(MutableSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
Expand Down Expand Up @@ -730,6 +732,7 @@ class set(MutableSet[_T], Generic[_T]):
def __lt__(self, s: AbstractSet[object]) -> bool: ...
def __ge__(self, s: AbstractSet[object]) -> bool: ...
def __gt__(self, s: AbstractSet[object]) -> bool: ...
__hash__: None

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