Skip to content

Commit b83ddc7

Browse files
committed
make index and EA base as non-hashable
1 parent 0761ba2 commit b83ddc7

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

pandas/core/arrays/base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,8 +1302,10 @@ def _reduce(self, name: str, *, skipna: bool = True, **kwargs):
13021302
"""
13031303
raise TypeError(f"cannot perform {name} with type {self.dtype}")
13041304

1305-
def __hash__(self) -> int:
1306-
raise TypeError(f"unhashable type: {repr(type(self).__name__)}")
1305+
# https://github.com/python/typeshed/issues/2148#issuecomment-520783318
1306+
# Incompatible types in assignment (expression has type "None", base class
1307+
# "object" defined the type as "Callable[[object], int]")
1308+
__hash__: None # type: ignore[assignment]
13071309

13081310
# ------------------------------------------------------------------------
13091311
# Non-Optimized Default Methods

pandas/core/indexes/base.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4562,9 +4562,10 @@ def __contains__(self, key: Any) -> bool:
45624562
except (OverflowError, TypeError, ValueError):
45634563
return False
45644564

4565-
@final
4566-
def __hash__(self):
4567-
raise TypeError(f"unhashable type: {repr(type(self).__name__)}")
4565+
# https://github.com/python/typeshed/issues/2148#issuecomment-520783318
4566+
# Incompatible types in assignment (expression has type "None", base class
4567+
# "object" defined the type as "Callable[[object], int]")
4568+
__hash__: None # type: ignore[assignment]
45684569

45694570
@final
45704571
def __setitem__(self, key, value):

0 commit comments

Comments
 (0)