Skip to content

Commit db134d6

Browse files
mstorahulkaushal04
andcommitted
fix: Shallow copy input dict in _empty_field_to_none validator
Avoid mutating the caller's dict by making a shallow copy before modifying empty Optional fields. Co-Authored-By: Rahul Kaushal <kaushalrahul15@gmail.com>
1 parent 41f2ec0 commit db134d6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fgmetric/metric.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ def _empty_field_to_none(cls, data: Any) -> Any:
8282
# short circuit
8383
return data
8484

85+
data = dict(data)
86+
8587
for field, value in data.items():
8688
info = cls.model_fields.get(field)
8789
if info is None:

0 commit comments

Comments
 (0)