split_whitespace(): Make sure delimiter is stripped from the beginning
of the remainder item (last item in list) when maxsplit is < the
number of occurrences.
diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c
index 9fc4b9b..6de624e 100644
--- a/Modules/stropmodule.c
+++ b/Modules/stropmodule.c
@@ -85,7 +85,10 @@
goto finally;
countsplit++;
- if (maxsplit && (countsplit >= maxsplit)) {
+ while (i < len && isspace(Py_CHARMASK(s[i]))) {
+ i = i+1;
+ }
+ if (maxsplit && (countsplit >= maxsplit) && i < len) {
item = PyString_FromStringAndSize(
s+i, (int)(len - i));
if (item == NULL)