Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
do not switch config type when merging configs
There is a subtle bug in the IncludeHandler that makes the config either a dict or an OrderedDict. If a single config is provided (that also means no lockfile), the raw result of the config parser is taken, which is a dict (since Python 3.6). If any merging operation of multiple configs is performed, this is converted into a OrderedDict, as otherwise the order of the keys is not preserved for Python < 3.6. As we only support Python 3.6+, this bug likely does not have any influence on the semantics of the config, but it does lead to inconsistent results when dumping the config again (as reported in #118). An OrderedDict is always serialized in order, a standard dict is sorted if not specified otherwise. This also affected the pretty-printed merged config on debug. Instead, we now solely rely on the preserved include order of Python dicts from Python 3.6 on (in 3.6 it is a implementation detail, later it became part of the spec). From Python 3.6 on there is no reason to use OrderedDict anymore, so better avoid it to be more robust when interfacing with other libraries (like json, pyyaml). Signed-off-by: Felix Moessbauer <[email protected]> Signed-off-by: Jan Kiszka <[email protected]>
- Loading branch information