From 6b01511f04da573d450cdffab471538e70aec01e Mon Sep 17 00:00:00 2001 From: David Smith <39445562+smithdc1@users.noreply.github.com> Date: Tue, 19 Jan 2021 05:52:34 +0000 Subject: [PATCH] Removed unnecessary empty dict creation in ChoiceWidget.create_option(). build_atttrs() already creates an empty dict if extra_attrs is None. --- django/forms/widgets.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 1b1c1439cb4..67e44829ff0 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -620,8 +620,6 @@ class ChoiceWidget(Widget): def create_option(self, name, value, label, selected, index, subindex=None, attrs=None): index = str(index) if subindex is None else "%s_%s" % (index, subindex) - if attrs is None: - attrs = {} option_attrs = self.build_attrs(self.attrs, attrs) if self.option_inherits_attrs else {} if selected: option_attrs.update(self.checked_attribute)