[pypy-commit] pypy default: (amaury) presize to maxsplit + 1 not maxsplit
bdkearns
noreply at buildbot.pypy.org
Tue Feb 12 23:17:24 CET 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r61154:2db1e1e6b77e
Date: 2013-02-12 17:16 -0500
http://bitbucket.org/pypy/pypy/changeset/2db1e1e6b77e/
Log: (amaury) presize to maxsplit + 1 not maxsplit
diff --git a/rpython/rlib/rstring.py b/rpython/rlib/rstring.py
--- a/rpython/rlib/rstring.py
+++ b/rpython/rlib/rstring.py
@@ -16,7 +16,7 @@
raise ValueError("empty separator")
if maxsplit > 0:
- res = newlist_hint(min(maxsplit, len(value)))
+ res = newlist_hint(min(maxsplit + 1, len(value)))
else:
res = []
start = 0
@@ -34,7 +34,7 @@
def rsplit(value, by, maxsplit=-1):
if maxsplit > 0:
- res = newlist_hint(min(maxsplit, len(value)))
+ res = newlist_hint(min(maxsplit + 1, len(value)))
else:
res = []
end = len(value)
More information about the pypy-commit
mailing list