[pypy-svn] r69541 - pypy/branch/stringbuilder/pypy/objspace/std

fijal at codespeak.net fijal at codespeak.net
Mon Nov 23 12:48:01 CET 2009


Author: fijal
Date: Mon Nov 23 12:48:01 2009
New Revision: 69541

Modified:
   pypy/branch/stringbuilder/pypy/objspace/std/unicodeobject.py
Log:
Re-read the length of the list since we can invoke arbitrary python code in between


Modified: pypy/branch/stringbuilder/pypy/objspace/std/unicodeobject.py
==============================================================================
--- pypy/branch/stringbuilder/pypy/objspace/std/unicodeobject.py	(original)
+++ pypy/branch/stringbuilder/pypy/objspace/std/unicodeobject.py	Mon Nov 23 12:48:01 2009
@@ -198,7 +198,8 @@
     # now we know it's a list of unicode or string
     lgt += len(delim) * (len(l_w) - 1)
     builder = UnicodeBuilder(lgt)
-    for i in range(len(l_w)):
+    i = 0
+    while i < space.int_w(space.len(w_list)):
         w_item = l_w[i]
         if isinstance(w_item, W_UnicodeObject):
             builder.append(w_item._value)
@@ -206,6 +207,7 @@
             builder.append(space.unicode_w(w_item))
         if i != len(l_w) - 1:
             builder.append(delim)
+        i += 1
     return W_UnicodeObject(builder.build())
 
 def hash__Unicode(space, w_uni):



More information about the Pypy-commit mailing list