mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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:
parent
15a1136547
commit
4c63a972d1
1 changed files with 5 additions and 1 deletions
|
@ -2349,7 +2349,11 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer,
|
|||
|
||||
p = 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 */
|
||||
width = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue