summaryrefslogtreecommitdiff
path: root/Objects/stringlib
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/stringlib')
-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 c1c2cf3781..d4719a578b 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.