[pypy-commit] pypy utf8-unicode2: Fix rstr.rsplit
waedt
noreply at buildbot.pypy.org
Sun Aug 10 09:14:58 CEST 2014
Author: Tyler Wade <wayedt at gmail.com>
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):
More information about the pypy-commit
mailing list