diff options
author | Barry Warsaw <barry@python.org> | 1997-12-02 00:29:30 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1997-12-02 00:29:30 (GMT) |
commit | 93be92d30925d2e2d387987e418b083f8bb6e26e (patch) | |
tree | ef707903114d09f25a2f12913b9785d7e7621513 /Modules/stropmodule.c | |
parent | 8529ebb78cdc454445f85c7e1c76bdcf0a4b9a94 (diff) | |
download | cpython-93be92d30925d2e2d387987e418b083f8bb6e26e.zip cpython-93be92d30925d2e2d387987e418b083f8bb6e26e.tar.gz cpython-93be92d30925d2e2d387987e418b083f8bb6e26e.tar.bz2 |
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.
Diffstat (limited to 'Modules/stropmodule.c')
-rw-r--r-- | Modules/stropmodule.c | 5 |
1 files changed, 4 insertions, 1 deletions
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 @@ 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) |