One function

handle_metavalues in dynaconf/dynaconf

The author described this change as fix: avoid crash merging a dynaconf_merge list into a missing key (#1410). It counts as a record because the check below fails on the code as it stood at cea5adf4b and passes on e95480910, with nothing else changed between the two runs.

Fix saved2026-06-27
Sharing licenceMIT · LICENSE
Change size+1 1

What the code was meant to do, written into the code itself as a docstring

Cleanup of MetaValues on new dict :param old: old values :param new: new values :param list_merge: Methods to use to merge lists - merge: default merge behavior, i.e. (unique) concatenation - shallow: replace the top-most level list of the nested structure - deep: iteratively traverse the nested structure and replace the element in the list at the level specified by the full_path

The change

5555 value.remove("dynaconf_merge_unique")
5656 unique = True
5757
58- for item in old.get(key)[::-1]:
58+ for item in (old.get(key) or [])[::-1]:
5959 if unique and item in value:
6060 continue
6161 value.insert(0, item)

The check that tells the two apart

failpass·tests/test_utils.py::test_merge_list_token_when_key_absent_in_old

Check file tests/test_utils.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 itcea5adf4b52556c216a275a3e1372aa052801329
Broken version dated2026-06-26
Moduledynaconf.utils.__init__
Units changedhandle_metavalues
Fingerprint347f404b7e687576
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