mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
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
1 changed files with 4 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue