Bug: Number of digits increased on the format object if reusing it

pull/90/head
Rune B. Broberg 2019-11-10 18:40:37 +01:00
rodzic 0a6e1e27de
commit e942b32d5a
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -77,10 +77,10 @@ class Value(object):
if fmt.max_nr_digits < 4:
formstr = ".0f"
else:
fmt.max_nr_digits += (
max_digits = fmt.max_nr_digits + (
(1 if not fmt.fix_decimals and real < 10 else 0) +
(1 if not fmt.fix_decimals and real < 100 else 0))
formstr = "." + str(fmt.max_nr_digits - 3) + "f"
formstr = "." + str(max_digits - 3) + "f"
result = format(real, formstr)