diff options
author | Georg Brandl <georg@python.org> | 2008-05-18 07:46:13 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-05-18 07:46:13 +0000 |
commit | 9e619c02149f716f1d3a966dc17e83beeb0b7ba3 (patch) | |
tree | b01604b4064997e8667cb710576c30417a4cf207 /Lib/_weakrefset.py | |
parent | fa6b13f1e491c8efc349212433a689faa8236259 (diff) | |
download | cpython-9e619c02149f716f1d3a966dc17e83beeb0b7ba3.tar.gz |
Fix two issues in the weak set implementation.
Diffstat (limited to 'Lib/_weakrefset.py')
-rw-r--r-- | Lib/_weakrefset.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/_weakrefset.py b/Lib/_weakrefset.py index e56ac048dd..a6827e8298 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 |