Author: Manuel Jacob
Branch: refactor-str-types
Changeset: r65793:f0078474599f
Date: 2013-07-29 16:33 +0200
http://bitbucket.org/pypy/pypy/changeset/f0078474599f/

Log:    Use space.listview_{str,unicode} in descr_join().

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
@@ -387,11 +387,21 @@
 
     @specialize.argtype(0)
     def descr_join(self, space, w_list):
-        #l = space.listview_str(w_list)
-        #if l is not None:
-        #    if len(l) == 1:
-        #        return space.wrap(l[0])
-        #    return space.wrap(self._val(space).join(l))
+        from pypy.objspace.std.bytesobject import W_BytesObject
+        from pypy.objspace.std.unicodeobject import W_UnicodeObject
+
+        if isinstance(self, W_BytesObject):
+            l = space.listview_str(w_list)
+            if l is not None:
+                if len(l) == 1:
+                    return space.wrap(l[0])
+                return space.wrap(self._val(space).join(l))
+        elif isinstance(self, W_UnicodeObject):
+            l = space.listview_unicode(w_list)
+            if l is not None:
+                if len(l) == 1:
+                    return space.wrap(l[0])
+                return space.wrap(self._val(space).join(l))
 
         list_w = space.listview(w_list)
         size = len(list_w)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to