summaryrefslogtreecommitdiffstats
path: root/Lib/_weakrefset.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-05-18 07:46:13 (GMT)
committerGeorg Brandl <georg@python.org>2008-05-18 07:46:13 (GMT)
commitbf93b0470affd720a603805eb00c917a9bc39cc9 (patch)
tree30cc457b9b52da94bbb3a0d8967689e2857e8f05 /Lib/_weakrefset.py
parente624d17409e2d2b29db48752a7004525402bf023 (diff)
downloadcpython-bf93b0470affd720a603805eb00c917a9bc39cc9.zip
cpython-bf93b0470affd720a603805eb00c917a9bc39cc9.tar.gz
cpython-bf93b0470affd720a603805eb00c917a9bc39cc9.tar.bz2
Fix two issues in the weak set implementation.
Diffstat (limited to 'Lib/_weakrefset.py')
-rw-r--r--Lib/_weakrefset.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/_weakrefset.py b/Lib/_weakrefset.py
index e56ac04..a6827e8 100644
--- a/Lib/_weakrefset.py
+++ b/Lib/_weakrefset.py
@@ -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