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.

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

8989 def __copy__(self):
9090 return self.copy()
9191
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+
92101 def __getitem__(self, item):
93102 try:
94103 result = super().__getitem__(item)

The check that tells the two apart

failpass·tests/test_nodes.py::TestDataDict::test_deepcopy
failpass·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