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.
This commit is contained in:
Barry Warsaw 1997-12-02 00:29:30 +00:00
parent 8529ebb78c
commit 93be92d309

View File

@ -85,7 +85,10 @@ split_whitespace(s, len, maxsplit)
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)