Cleanup PyUnicode_FromFormatV() for zero padding

Skip the "0" instead of parsing it twice: detect zero padding and then parsed
as a digit of the width.
This commit is contained in:
Victor Stinner 2012-10-06 23:55:33 +02:00
parent 15a1136547
commit 4c63a972d1
1 changed files with 5 additions and 1 deletions

View File

@ -2349,7 +2349,11 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer,
p = f; p = f;
f++; f++;
zeropad = (*f == '0'); zeropad = 0;
if (*f == '0') {
zeropad = 1;
f++;
}
/* parse the width.precision part, e.g. "%2.5s" => width=2, precision=5 */ /* parse the width.precision part, e.g. "%2.5s" => width=2, precision=5 */
width = 0; width = 0;