One function
_get_data_by_key in dynaconf/dynaconf
The author described this change as “fix(inspect): Fixed an error that would raise when using get_history() with lazy values (#1184)”. It counts as a record because the check below fails on the code as it stood at 285c4f958 and passes on b23dac456, with nothing else changed between the two runs.
Projectdynaconf/dynaconf
Fix saved2024-10-04
Sharing licenceMIT · LICENSE
Change size+8 −2
What the code was meant to do, written into the code itself as a docstring
Returns value found in data[key] using dot-path str (e.g, "path.to.key"). Raises KeyError if not found
The change
| 14 | 14 | if sep in key_dotted_path: | |
| 15 | 15 | key_dotted_path = key_dotted_path.replace(sep, ".") | |
| 16 | 16 | ||
| 17 | + | def handle_repr(value): | |
| 18 | + | # lazy values shouldnt be evaluated for inspecting | |
| 19 | + | if isinstance(value, Lazy): | |
| 20 | + | return value._dynaconf_encode() | |
| 21 | + | return value | |
| 22 | + | ||
| 17 | 23 | def traverse_data(data, path): | |
| 18 | 24 | # transform `a.b.c` in successive calls to `data['a']['b']['c']` | |
| 19 | 25 | path = path.split(".") | |
| 20 | 26 | root_key, nested_keys = path[0], path[1:] | |
| 21 | - | result = data[root_key] | |
| 27 | + | result = data._safe_get(root_key) | |
| 22 | 28 | for key in nested_keys: | |
| 23 | - | result = result[key] | |
| 29 | + | result = handle_repr(result._safe_get(key)) | |
| 24 | 30 | return result | |
| 25 | 31 | ||
| 26 | 32 | try: |
The check that tells the two apart
fail→pass·tests/test_inspect.py::tests_get_history_with_variable_interpolation
Check file tests/test_inspect.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 it285c4f958d4ca16541a66791857cdf6ccaa9962f
Broken version dated2024-08-09
Moduledynaconf.utils.inspect
Units changed_get_data_by_key
Fingerprint5cc5a2688dd86ab8
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-31fix: add __deepcopy__ to DataDict to match DataList (#1440)
- 2026-07-29normalize_kwargs
- 2026-07-29handle_metavalues
- 2026-07-29object_merge