Skip to content

Commit e192bfb

Browse files
authored
Do not deepcopy section schema when applying suggested values (#141280)
Do not deep copy section schema when appying suggested values
1 parent 358f78c commit e192bfb

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

homeassistant/data_entry_flow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ def add_suggested_values_to_schema(
666666
new_section_key = copy.copy(key)
667667
schema[new_section_key] = val
668668
val.schema = self.add_suggested_values_to_schema(
669-
copy.deepcopy(val.schema), suggested_values[key]
669+
val.schema, suggested_values[key]
670670
)
671671
continue
672672

tests/test_data_entry_flow.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ async def async_step_init(self, user_input=None):
178178
assert markers[2] == "section_1"
179179
section_validator = form["data_schema"].schema["section_1"]
180180
assert isinstance(section_validator, data_entry_flow.section)
181+
# The section class was not replaced
182+
assert section_validator is schema.schema["section_1"]
183+
# The section schema was not replaced
184+
assert section_validator.schema is schema.schema["section_1"].schema
181185
section_markers = list(section_validator.schema.schema)
182186
assert len(section_markers) == 1
183187
assert section_markers[0] == "full_name"

0 commit comments

Comments
 (0)