From e911e0996f1096cc23ef03b1ca70da7499dd8f2f Mon Sep 17 00:00:00 2001 From: Jimmy Angelakos Date: Sat, 10 Sep 2022 14:04:45 +0100 Subject: Fixed #34000 -- Fixed numberformat.format() crash on empty strings. --- django/utils/numberformat.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'django') diff --git a/django/utils/numberformat.py b/django/utils/numberformat.py index 488d6a77cd..35bbdd39e1 100644 --- a/django/utils/numberformat.py +++ b/django/utils/numberformat.py @@ -25,6 +25,8 @@ def format( module in locale.localeconv() LC_NUMERIC grouping (e.g. (3, 2, 0)). * thousand_sep: Thousand separator symbol (for example ",") """ + if number == "": + return mark_safe(number) use_grouping = ( use_l10n or (use_l10n is None and settings.USE_L10N) ) and settings.USE_THOUSAND_SEPARATOR -- cgit v1.3