[Python-3000-checkins] r63443 - python/branches/py3k/Lib/_weakrefset.py

georg.brandl python-3000-checkins at python.org
Sun May 18 09:46:13 CEST 2008


Author: georg.brandl
Date: Sun May 18 09:46:13 2008
New Revision: 63443

Log:
Fix two issues in the weak set implementation.


Modified:
   python/branches/py3k/Lib/_weakrefset.py

Modified: python/branches/py3k/Lib/_weakrefset.py
==============================================================================
--- python/branches/py3k/Lib/_weakrefset.py	(original)
+++ python/branches/py3k/Lib/_weakrefset.py	Sun May 18 09:46:13 2008
@@ -41,7 +41,10 @@
 
     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 @@
     __ixor__ = symmetric_difference_update
 
     def union(self, other):
-        self._apply_mutate(other, self.data.union)
+        return self._apply(other, self.data.union)
     __or__ = union


More information about the Python-3000-checkins mailing list