]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
python-format: Accept null precision.
authorBruno Haible <bruno@clisp.org>
Sun, 22 Jun 2025 00:48:26 +0000 (02:48 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 22 Jun 2025 00:48:26 +0000 (02:48 +0200)
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.

gettext-tools/src/format-python.c
gettext-tools/tests/format-python-1

index ba2f6a0195953e3fff818a4256862c8bcdea4a47..5fce1397e17127bd547b1d355264a1f671b84fc9 100644 (file)
@@ -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,
index 1bbc9824a8ce470023d975d41609ce63dab6b549..28211a206394a48d977b1ac829fc679f4267970f 100755 (executable)
@@ -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