Commit 9e619c02 authored by Georg Brandl's avatar Georg Brandl

Fix two issues in the weak set implementation.

parent fa6b13f1
......@@ -41,7 +41,10 @@ class WeakSet:
def pop(self):
while True:
itemref = self.data.pop()
try:
itemref = self.data.pop()
except KeyError:
raise KeyError('pop from empty WeakSet')
item = itemref()
if item is not None:
return item
......@@ -107,5 +110,5 @@ class WeakSet:
__ixor__ = symmetric_difference_update
def union(self, other):
self._apply_mutate(other, self.data.union)
return self._apply(other, self.data.union)
__or__ = union
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment