[pypy-commit] pypy set-strategies: added test and fix for update on empty sets

l.diekmann noreply at buildbot.pypy.org
Thu Nov 10 13:51:38 CET 2011


Author: Lukas Diekmann <lukas.diekmann at uni-duesseldorf.de>
Branch: set-strategies
Changeset: r49222:64702787279f
Date: 2011-10-11 14:49 +0200
http://bitbucket.org/pypy/pypy/changeset/64702787279f/

Log:	added test and fix for update on empty sets

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
@@ -285,7 +285,7 @@
 
     def update(self, w_set, w_other):
         w_set.strategy = w_other.strategy
-        w_set.storage = w_other.get_storage_copy()
+        w_set.sstorage = w_other.get_storage_copy()
 
     def iter(self, w_set):
         return EmptyIteratorImplementation(self.space, w_set)
diff --git a/pypy/objspace/std/test/test_setobject.py b/pypy/objspace/std/test/test_setobject.py
--- a/pypy/objspace/std/test/test_setobject.py
+++ b/pypy/objspace/std/test/test_setobject.py
@@ -324,6 +324,9 @@
         s1 = set('abc')
         s1.update('d', 'ef', frozenset('g'))
         assert s1 == set('abcdefg')
+        s1 = set()
+        s1.update(set('abcd'))
+        assert s1 == set('abcd')
 
     def test_recursive_repr(self):
         class A(object):


More information about the pypy-commit mailing list