diff options
| author | Kasyap Pentamaraju <vpentamaraju@webmd.net> | 2025-11-07 10:31:53 +0530 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2025-11-10 14:45:48 -0500 |
| commit | fffa64abc3870989d62659453cb302857c539956 (patch) | |
| tree | ef18645bcf2a23bab31b4179603a7a5dbd84d7ab /django/utils | |
| parent | e78420c2b8ef62acb6b7a37b71e3aa6833d630fb (diff) | |
Fixed #36715 -- Handled non-finite Decimals in intcomma filter.
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/numberformat.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/django/utils/numberformat.py b/django/utils/numberformat.py index f621ff64b4..c064ce6918 100644 --- a/django/utils/numberformat.py +++ b/django/utils/numberformat.py @@ -48,6 +48,9 @@ def format( if abs(number) < cutoff: number = Decimal("0") + if not number.is_finite(): + return str(number) + # Format values with more than 200 digits (an arbitrary cutoff) using # scientific notation to avoid high memory usage in {:f}'.format(). _, digits, exponent = number.as_tuple() |
