mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
Issue #6850: Fix bug in Decimal._parse_format_specifier for formats
with no type specifier.
This commit is contained in:
parent
d692a71fdd
commit
491ea55f28
3 changed files with 7 additions and 1 deletions
|
@ -5512,7 +5512,7 @@ def _parse_format_specifier(format_spec, _localeconv=None):
|
|||
# if format type is 'g' or 'G' then a precision of 0 makes little
|
||||
# sense; convert it to 1. Same if format type is unspecified.
|
||||
if format_dict['precision'] == 0:
|
||||
if format_dict['type'] in 'gG' or format_dict['type'] is None:
|
||||
if format_dict['type'] is None or format_dict['type'] in 'gG':
|
||||
format_dict['precision'] = 1
|
||||
|
||||
# determine thousands separator, grouping, and decimal separator, and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue