From 340f82cfabf72c01d1a8fdd63a5dcad45650aff6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 24 Jun 2025 11:15:46 +0200 Subject: [PATCH] Python: Fix bug in python-brace-format. * gettext-tools/src/format-python-brace.c (parse_directive): The name ends before ':', not before '}'. --- gettext-tools/src/format-python-brace.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gettext-tools/src/format-python-brace.c b/gettext-tools/src/format-python-brace.c index d66519616..51086133b 100644 --- a/gettext-tools/src/format-python-brace.c +++ b/gettext-tools/src/format-python-brace.c @@ -142,6 +142,7 @@ parse_directive (struct spec *spec, const char *format = *formatp; const char *const format_start = format; const char *name_start; + const char *name_end; char c; c = *++format; @@ -245,6 +246,8 @@ parse_directive (struct spec *spec, break; } + name_end = format; + /* Here c == *format. */ if (c == ':') { @@ -352,7 +355,7 @@ parse_directive (struct spec *spec, if (is_toplevel) { char *name; - size_t n = format - name_start; + size_t n = name_end - name_start; FDI_SET (name_start - 1, FMTDIR_START); -- 2.47.3