[pypy-commit] pypy refactor-str-types: Fix.

Manuel Jacob noreply at buildbot.pypy.org
Fri Jul 26 22:36:51 CEST 2013


Author: Manuel Jacob
Branch: refactor-str-types
Changeset: r65698:b14c953c9702
Date: 2013-07-26 18:16 +0200
http://bitbucket.org/pypy/pypy/changeset/b14c953c9702/

Log:	Fix.

diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -44,6 +44,7 @@
         assert len(char) == 1
         return str(char)[0]
 
+    _empty = ''
     _builder = StringBuilder
 
     def _newlist_unwrapped(self, space, res):
diff --git a/pypy/objspace/std/bytesobject.py b/pypy/objspace/std/bytesobject.py
--- a/pypy/objspace/std/bytesobject.py
+++ b/pypy/objspace/std/bytesobject.py
@@ -86,6 +86,7 @@
         assert len(char) == 1
         return str(char)[0]
 
+    _empty = ''
     _builder = StringBuilder
 
     def _isupper(self, ch):
diff --git a/pypy/objspace/std/stringmethods.py b/pypy/objspace/std/stringmethods.py
--- a/pypy/objspace/std/stringmethods.py
+++ b/pypy/objspace/std/stringmethods.py
@@ -144,7 +144,7 @@
                 assert start >= 0 and stop >= 0
                 return self._sliced(space, selfvalue, start, stop, self)
             else:
-                str = "".join([selfvalue[start + i*step] for i in range(sl)])
+                str = self._empty.join([selfvalue[start + i*step] for i in range(sl)])
             return self._new(str)
 
         index = space.getindex_w(w_index, space.w_IndexError, "string index")
diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -87,6 +87,7 @@
         assert len(char) == 1
         return unicode(char)[0]
 
+    _empty = u''
     _builder = UnicodeBuilder
 
     def _isupper(self, ch):


More information about the pypy-commit mailing list