Antonio Cuni avatar Antonio Cuni committed 36ecc34

unicode.join uses listview_unicode

Comments (0)

Files changed (2)

pypy/objspace/std/test/test_liststrategies.py

         w_l.getitems = None
         assert space.str_w(space.call_method(space.wrap("c"), "join", w_l)) == "acb"
 
+    def test_unicode_join_uses_listview_unicode(self):
+        space = self.space
+        w_l = self.space.newlist([self.space.wrap(u'a'), self.space.wrap(u'b')])
+        w_l.getitems = None
+        assert space.unicode_w(space.call_method(space.wrap(u"c"), "join", w_l)) == u"acb"
+
     def test_string_join_returns_same_instance(self):
         space = self.space
         w_text = space.wrap("text")

pypy/objspace/std/unicodeobject.py

     return space.newbool(container.find(item) != -1)
 
 def unicode_join__Unicode_ANY(space, w_self, w_list):
+    l = space.listview_unicode(w_list)
+    if l is not None:
+        if len(l) == 1:
+            return space.wrap(l[0])
+        return space.wrap(w_self._value.join(l))
     list_w = space.listview(w_list)
     size = len(list_w)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.