mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #34363 -- Fixed floatformat crash on zero with trailing zeros.
Regression in08c5a78726. Follow up to4b066bde69.
This commit is contained in:
committed by
GitHub
parent
ad18a0102c
commit
dcd9746983
@@ -3,7 +3,7 @@ import random as random_module
|
||||
import re
|
||||
import types
|
||||
import warnings
|
||||
from decimal import ROUND_HALF_UP, Context, Decimal, InvalidOperation
|
||||
from decimal import ROUND_HALF_UP, Context, Decimal, InvalidOperation, getcontext
|
||||
from functools import wraps
|
||||
from inspect import unwrap
|
||||
from operator import itemgetter
|
||||
@@ -184,6 +184,7 @@ def floatformat(text, arg=-1):
|
||||
units = len(tupl[1])
|
||||
units += -tupl[2] if m else tupl[2]
|
||||
prec = abs(p) + units + 1
|
||||
prec = max(getcontext().prec, prec)
|
||||
|
||||
# Avoid conversion to scientific notation by accessing `sign`, `digits`,
|
||||
# and `exponent` from Decimal.as_tuple() directly.
|
||||
|
||||
Reference in New Issue
Block a user