Commits

Lukas Diekmann committed 67ea580

what the hell did we do here!?

Comments (0)

Files changed (2)

pypy/objspace/std/setobject.py

     others_w.append(w_left)
 
     # find smallest set in others_w to reduce comparisons
-    startindex, startlength = -1, -1
+    startindex, startlength = 0, -1
     for i in range(len(others_w)):
         w_other = others_w[i]
         try:
                 raise
             continue
 
-        if length < startlength:
+        if startlength == -1 or length < startlength:
             startindex = i
             startlength = length
 
-    others_w[i], others_w[0] = others_w[0], others_w[i]
+    others_w[startindex], others_w[0] = others_w[0], others_w[startindex]
 
     result = w_left._newobj(space, others_w[0])
     for i in range(1,len(others_w)):

pypy/objspace/std/test/test_setobject.py

 
         d = W_SetObject(self.space)
         _initialize_set(self.space, d, self.space.wrap("ab"))
-        d.intersect = None
+
+        # if ordering works correct we should start with set e
+        a.get_storage_copy = None
+        b.get_storage_copy = None
+        d.get_storage_copy = None
 
         result = set_intersection__Set(space, a, [d,c,b])
         assert space.is_true(self.space.eq(result, W_SetObject(space, self.space.wrap(""))))