Author: Lukas Diekmann <[email protected]>
Branch: set-strategies
Changeset: r49231:32d6410e50da
Date: 2011-10-12 10:12 +0200
http://bitbucket.org/pypy/pypy/changeset/32d6410e50da/

Log:    replaced getkeys by using iterator

diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py
--- a/pypy/objspace/std/setobject.py
+++ b/pypy/objspace/std/setobject.py
@@ -658,9 +658,15 @@
 
     def update(self, w_set, w_other):
         d_obj = self.unerase(w_set.sstorage)
-        other_w = w_other.getkeys()
-        for w_key in other_w:
-            d_obj[w_key] = None
+        w_iterator = self.space.iter(w_other)
+        while True:
+            try:
+                w_item = self.space.next(w_iterator)
+                d_obj[w_item] = None
+            except OperationError, e:
+                if not e.match(self.space, self.space.w_StopIteration):
+                    raise
+                break
 
 class IteratorImplementation(object):
     def __init__(self, space, implementation):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to