From: Georg Brandl Date: Sun, 18 May 2008 07:46:13 +0000 (+0000) Subject: Fix two issues in the weak set implementation. X-Git-Tag: v3.0b1~281 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bf93b0470affd720a603805eb00c917a9bc39cc9;p=python Fix two issues in the weak set implementation. --- 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