[pypy-commit] pypy set-strategies: use string strategy when appending string to empty set

l.diekmann noreply at buildbot.pypy.org
Thu Nov 10 13:52:33 CET 2011


Author: Lukas Diekmann <lukas.diekmann at uni-duesseldorf.de>
Branch: set-strategies
Changeset: r49264:a7633ebf174b
Date: 2011-11-04 14:49 +0100
http://bitbucket.org/pypy/pypy/changeset/a7633ebf174b/

Log:	use string strategy when appending string to empty set

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
@@ -311,6 +311,8 @@
     def add(self, w_set, w_key):
         if type(w_key) is W_IntObject:
             strategy = self.space.fromcache(IntegerSetStrategy)
+        elif type(w_key) is W_StringObject:
+            strategy = self.space.fromcache(StringSetStrategy)
         else:
             strategy = self.space.fromcache(ObjectSetStrategy)
         w_set.strategy = strategy


More information about the pypy-commit mailing list