Fix two issues in the weak set implementation.

This commit is contained in:
Georg Brandl 2008-05-18 07:46:13 +00:00
parent e624d17409
commit bf93b0470a
1 changed files with 5 additions and 2 deletions

View File

@ -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