Author: Carl Friedrich Bolz <[email protected]>
Branch: bitset-intsets
Changeset: r95942:6ce89c9c6bae
Date: 2016-02-27 17:31 +0100
http://bitbucket.org/pypy/pypy/changeset/6ce89c9c6bae/

Log:    fix update

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
@@ -1442,7 +1442,8 @@
         if self is w_other.strategy:
             d_set = self.unerase(w_set.sstorage)
             d_other = self.unerase(w_other.sstorage)
-            d_set.update(d_other)
+            for key, item in d_other.iteritems():
+                d_set[key] = d_set.get(key, 0) | item
             return
         if w_other.length() == 0:
             return
diff --git a/pypy/objspace/std/test/test_setstrategies.py 
b/pypy/objspace/std/test/test_setstrategies.py
--- a/pypy/objspace/std/test/test_setstrategies.py
+++ b/pypy/objspace/std/test/test_setstrategies.py
@@ -247,6 +247,17 @@
                 assert not s.has_key(self.wrap(i))
         # XXX check that no additional keys
 
+    @given(intlists, intlists)
+    def test_union(self, c1, c2):
+        s1 = self.intset(c1)
+        s2 = self.intset(c2)
+        s = s1.copy_real()
+        s.update(s2)
+        for i in c1:
+            assert s.has_key(self.wrap(i))
+        for i in c2:
+            assert s.has_key(self.wrap(i))
+        # XXX check that no additional keys
 
     @given(intlists, intlists)
     def test_issubset(self, c1, c2):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to