From: Bruno Haible Date: Sun, 22 Jun 2025 00:48:26 +0000 (+0200) Subject: python-format: Accept null precision. X-Git-Tag: v0.26~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6ea1c2cbe405f78f53fae0ae39b7baecf1cb332;p=thirdparty%2Fgettext.git python-format: Accept null precision. Proof that it's valid: $ python print("%(value).f" % { 'value': 3.1415926535 }) * gettext-tools/src/format-python.c: Fix comment regarding the precision. * gettext-tools/tests/format-python-1: Add a test case with null precision. --- diff --git a/gettext-tools/src/format-python.c b/gettext-tools/src/format-python.c index ba2f6a019..5fce1397e 100644 --- a/gettext-tools/src/format-python.c +++ b/gettext-tools/src/format-python.c @@ -50,7 +50,7 @@ - is optionally followed by a width specification: '*' (reads an argument) or a nonempty digit sequence, - is optionally followed by '.' and a precision specification: '*' (reads - an argument) or a nonempty digit sequence, + an argument) or an optional nonempty digit sequence, - is optionally followed by a size specifier, one of 'h' 'l' 'L'. - is finished by a specifier - '%', that needs no argument, diff --git a/gettext-tools/tests/format-python-1 b/gettext-tools/tests/format-python-1 index 1bbc9824a..28211a206 100755 --- a/gettext-tools/tests/format-python-1 +++ b/gettext-tools/tests/format-python-1 @@ -64,6 +64,8 @@ cat <<\EOF > f-p-1.data "abc%y" # Invalid: flags after width "abc%*0g" +# Valid: null precision +"abc%.f" # Invalid: twice precision "abc%.4.2g" # Invalid: two size specifiers