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:
parent
8529ebb78c
commit
93be92d309
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue