Whole file
dynaconf/dynaconf
The author described this change as “fix: add __deepcopy__ to DataDict to match DataList (#1440)”. It counts as a record because the checks below fail on the code as it stood at dbae7f17b and pass on 3c0cb3cbe, with nothing else changed between the two runs.
Projectdynaconf/dynaconf
Fix saved2026-07-31
Sharing licenceMIT · LICENSE
Change size+9 −0
What the code was meant to do, written into the code itself as a save note
fix: add __deepcopy__ to DataDict to match DataList (#1440)
The change
| 89 | 89 | def __copy__(self): | |
| 90 | 90 | return self.copy() | |
| 91 | 91 | ||
| 92 | + | def __deepcopy__(self, memo=None): | |
| 93 | + | memo = memo or {} | |
| 94 | + | out = self.__class__(core=self.__meta__.core) | |
| 95 | + | out.__meta__.data_env = self.__meta__.data_env | |
| 96 | + | memo[id(self)] = out | |
| 97 | + | for k, v in dict.items(self): | |
| 98 | + | out[copy.deepcopy(k, memo=memo)] = copy.deepcopy(v, memo=memo) | |
| 99 | + | return out | |
| 100 | + | ||
| 92 | 101 | def __getitem__(self, item): | |
| 93 | 102 | try: | |
| 94 | 103 | result = super().__getitem__(item) |
The check that tells the two apart
fail→pass·tests/test_nodes.py::TestDataDict::test_deepcopy
fail→pass·tests/test_nodes.py::TestDataDict::test_deepcopy_does_not_traverse_core
Check file tests/test_nodes.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itdbae7f17bef45beaf69744704bb27c0377ef0528
Broken version dated2026-07-29
Moduledynaconf.nodes
Units changedDataDict
Fingerprintb046d429f51b5df1
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in dynaconf/dynaconf
- 2026-08-05find_the_correct_casing
- 2026-08-01get_history
- 2026-07-29normalize_kwargs
- 2026-07-29handle_metavalues
- 2026-07-29object_merge
- 2026-07-29fix(nodes): convert container subclasses (#1436)