summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-10-06 21:55:33 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-10-06 21:55:33 (GMT)
commit4c63a972d194459ac17994d7f6d0be012880d740 (patch)
treeb08f323fa8101ce0bc0830243a3244f4401b0936 /Objects
parent15a1136547d1d5c4d5323f3213f5fa36f17d7e9d (diff)
downloadcpython-4c63a972d194459ac17994d7f6d0be012880d740.zip
cpython-4c63a972d194459ac17994d7f6d0be012880d740.tar.gz
cpython-4c63a972d194459ac17994d7f6d0be012880d740.tar.bz2
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.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 0ed38fe..73a3dc4 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -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;