Author: Tyler Wade <[email protected]>
Branch: utf8-unicode2
Changeset: r72740:5f2ee0bf8c2c
Date: 2014-08-10 00:45 -0500
http://bitbucket.org/pypy/pypy/changeset/5f2ee0bf8c2c/

Log:    Fix rstr.rsplit

diff --git a/rpython/rtyper/lltypesystem/rstr.py 
b/rpython/rtyper/lltypesystem/rstr.py
--- a/rpython/rtyper/lltypesystem/rstr.py
+++ b/rpython/rtyper/lltypesystem/rstr.py
@@ -988,7 +988,7 @@
         markerlen = len(c.chars)
         pos = s.rfind(c, 0, pos)
         while pos >= 0 and count <= max:
-            pos = s.rfind(c, 0, pos - markerlen)
+            pos = s.rfind(c, 0, pos)
             count += 1
         res = LIST.ll_newlist(count)
         items = res.ll_items()
diff --git a/rpython/rtyper/test/test_rstr.py b/rpython/rtyper/test/test_rstr.py
--- a/rpython/rtyper/test/test_rstr.py
+++ b/rpython/rtyper/test/test_rstr.py
@@ -760,6 +760,11 @@
             res = self.interpret(f, [i])
             assert res == True
 
+        def f():
+            return "a//b//c//d".rsplit("//") == ["a", "b", "c", "d"]
+        res = self.interpret(f, [])
+        assert res == f()
+
     def test_rsplit(self):
         fn = self._make_split_test('rsplit')
         for i in range(5):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to