[pypy-commit] pypy set-strategies: move objectstrategy case to ObjectSetStrategy

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


Author: Lukas Diekmann <lukas.diekmann at uni-duesseldorf.de>
Branch: set-strategies
Changeset: r49229:8be9bb5879b8
Date: 2011-10-11 15:38 +0200
http://bitbucket.org/pypy/pypy/changeset/8be9bb5879b8/

Log:	move objectstrategy case to ObjectSetStrategy

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
@@ -589,17 +589,8 @@
             return self._isdisjoint_wrapped(w_set, w_other)
 
     def update(self, w_set, w_other):
-        # XXX again, this is equivalent to self is self.space.fromcache(ObjectSetStrategy)
-        # this shows that the following condition is nonsense! you should
-        # instead overwrite update in ObjectSetStrategy and kill the if here
-        if w_set.strategy is self.space.fromcache(ObjectSetStrategy):
-            d_obj = self.unerase(w_set.sstorage)
-            other_w = w_other.getkeys()
-            for w_key in other_w:
-                d_obj[self.unwrap(w_key)] = None
-            return
 
-        elif w_set.strategy is w_other.strategy:
+        if self is w_other.strategy:
             # XXX d_int is a sucky variable name, other should be d_other
             d_int = self.unerase(w_set.sstorage)
             other = self.unerase(w_other.sstorage)
@@ -667,6 +658,12 @@
     def iter(self, w_set):
         return RDictIteratorImplementation(self.space, self, w_set)
 
+    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
+
 class IteratorImplementation(object):
     def __init__(self, space, implementation):
         self.space = space


More information about the pypy-commit mailing list