One function
normalize_kwargs in dynaconf/dynaconf
The author described this change as “fix: Fixed error when passing a list values for env on dynaconf init (#1278) (#1421)”. It counts as a record because the checks below fail on the code as it stood at be353f739 and pass on 5a0ebf1c5, with nothing else changed between the two runs.
Projectdynaconf/dynaconf
Fix saved2026-07-29
Sharing licenceMIT · LICENSE
Change size+12 −0
What the code was meant to do, written into the code itself as a docstring
Resolve names in the user provided keyword arguments.
The change
| 29 | 29 | for c_old, c_new in RENAMED_VARS.items(): | |
| 30 | 30 | if c_new == new: | |
| 31 | 31 | kwargs[c_old] = kwargs[new] | |
| 32 | + | ||
| 33 | + | # A list passed as `env` is the programmatic equivalent of the | |
| 34 | + | # comma-separated ENV_FOR_DYNACONF environment variable. Normalize it here | |
| 35 | + | # so all loaders can use their existing multi-environment handling. #1278 | |
| 36 | + | env = kwargs.get("ENV_FOR_DYNACONF") | |
| 37 | + | if isinstance(env, list): | |
| 38 | + | if not all(isinstance(item, str) for item in env): | |
| 39 | + | raise TypeError("'env' must be a string or a list of strings") | |
| 40 | + | kwargs["ENV_FOR_DYNACONF"] = ",".join(env) | |
| 41 | + | elif env is not None and not isinstance(env, str): | |
| 42 | + | raise TypeError("'env' must be a string or a list of strings") | |
| 43 | + | ||
| 32 | 44 | return kwargs |
The check that tells the two apart
fail→pass·tests/test_base.py::test_env_kwarg_accepts_a_list[ENV_FOR_DYNACONF]
fail→pass·tests/test_base.py::test_env_kwarg_accepts_a_list[env]
fail→pass·tests/test_base.py::test_env_kwarg_rejects_invalid_values[1]
fail→pass·tests/test_base.py::test_env_kwarg_rejects_invalid_values[env0]
Check file tests/test_base.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 itbe353f7399899d4c224fcf3b9959b6470ed02ca8
Broken version dated2026-07-29
Moduledynaconf.utils.__init__
Units changednormalize_kwargs
Fingerprint657746ebd8d85ee8
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-29handle_metavalues
- 2026-07-29object_merge
- 2026-07-29fix(nodes): convert container subclasses (#1436)