[pypy-commit] pypy set-strategies: referenced i before assignment if others_w is None/empty

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


Author: Lukas Diekmann <lukas.diekmann at uni-duesseldorf.de>
Branch: set-strategies
Changeset: r49269:fc5601b33c58
Date: 2011-11-08 14:12 +0100
http://bitbucket.org/pypy/pypy/changeset/fc5601b33c58/

Log:	referenced i before assignment if others_w is None/empty

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
@@ -1227,7 +1227,8 @@
             startindex = i
             startlength = length
 
-    others_w[i], others_w[0] = others_w[0], others_w[i]
+    if i > 0:
+        others_w[i], others_w[0] = others_w[0], others_w[i]
 
     result = w_left._newobj(space, others_w[0])
     for i in range(1,len(others_w)):


More information about the pypy-commit mailing list