From 0d6aa7f0ee38eb453bc8f73bf4830e6172be2f35 Mon Sep 17 00:00:00 2001 From: han-solo Date: Tue, 1 Sep 2020 10:34:29 -0400 Subject: bpo-41681: Fix for `f-string/str.format` error description when using 2 `,` in format specifier (GH-22036) * Fixed `f-string/str.format` error description when using two `,` in format specifier. Co-authored-by: millefalcon --- Python/formatter_unicode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Python/formatter_unicode.c') diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c index 74638ca223..ed95f267d4 100644 --- a/Python/formatter_unicode.c +++ b/Python/formatter_unicode.c @@ -252,8 +252,10 @@ parse_internal_render_format_spec(PyObject *format_spec, ++pos; } if (end-pos && READ_spec(pos) == ',') { - invalid_comma_and_underscore(); - return 0; + if (format->thousands_separators == LT_UNDERSCORE_LOCALE) { + invalid_comma_and_underscore(); + return 0; + } } /* Parse field precision */ -- cgit v1.2.1