bpo-41681: Fix for f-string/str.format error description when using 2 , in format specifier (GH-22036) (GH-22041)

* Fixed `f-string/str.format` error description when using two `,` in format specifier.

Co-authored-by: millefalcon <hanish0019@hmail.com>
(cherry picked from commit 0d6aa7f0ee)

Co-authored-by: han-solo <hanish0019@gmail.com>

Co-authored-by: han-solo <hanish0019@gmail.com>
This commit is contained in:
Miss Islington (bot) 2020-09-01 08:45:59 -07:00 committed by GitHub
parent ca55ecbf9a
commit c16a2a1b64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 2 deletions

View file

@ -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 */