Skip to content

Commit 5eb9416

Browse files
committed
fix deque __hash__
1 parent 05db2f8 commit 5eb9416

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

graalpython/lib-graalpython/_collections.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def extend(self, iterable):
207207
"""Extend the right side of the deque with elements from the iterable"""
208208
# Handle case where id(deque) == id(iterable)
209209
if self == iterable:
210-
return self.extend(list(iterable))
210+
iterable = list(iterable)
211211

212212
_iter = iter(iterable)
213213
while True:
@@ -234,9 +234,15 @@ def __mul__(self, times):
234234
def __rmul__(self, times):
235235
return _mul(deque(self, maxlen=self.maxlen), times)
236236

237+
def __hash__(self):
238+
raise TypeError("unhashable type: '%s'" % self.__name__)
239+
237240
def extendleft(self, iterable):
238241
"""Extend the left side of the deque with elements from the iterable"""
239242
# Handle case where id(deque) == id(iterable)
243+
if self == iterable:
244+
iterable = list(iterable)
245+
240246
_iter = iter(iterable)
241247
while True:
242248
try:

0 commit comments

Comments
 (0)