summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2013-11-27 01:22:36 (GMT)
committerBenjamin Peterson <benjamin@python.org>2013-11-27 01:22:36 (GMT)
commit0ee22bf7743dc9a6d593c432f787d7bfe70be199 (patch)
tree35c34cd1bd9814b4d0de300cd94c56ee4b33cb7f /Objects
parentbb65b5bf1dcc17519e4173ecb64a86228cc5cb58 (diff)
downloadcpython-0ee22bf7743dc9a6d593c432f787d7bfe70be199.zip
cpython-0ee22bf7743dc9a6d593c432f787d7bfe70be199.tar.gz
cpython-0ee22bf7743dc9a6d593c432f787d7bfe70be199.tar.bz2
fix format spec recursive expansion (closes #19729)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/stringlib/unicode_format.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/stringlib/unicode_format.h b/Objects/stringlib/unicode_format.h
index c1c2cf3..d4719a5 100644
--- a/Objects/stringlib/unicode_format.h
+++ b/Objects/stringlib/unicode_format.h
@@ -727,8 +727,10 @@ MarkupIterator_next(MarkupIterator *self, SubString *literal,
while (self->str.start < self->str.end) {
switch (c = PyUnicode_READ_CHAR(self->str.str, self->str.start++)) {
case ':':
- hit_format_spec = 1;
- count = 1;
+ if (!hit_format_spec) {
+ count = 1;
+ hit_format_spec = 1;
+ }
break;
case '{':
/* the format spec needs to be recursively expanded.