diff --git a/lib/ansible/utils/vars.py b/lib/ansible/utils/vars.py index d53473412f..ba232c2b68 100644 --- a/lib/ansible/utils/vars.py +++ b/lib/ansible/utils/vars.py @@ -32,7 +32,9 @@ def combine_vars(a, b): if C.DEFAULT_HASH_BEHAVIOUR == "merge": return merge_hash(a, b) else: - return dict(a.items() + b.items()) + result = a.copy() + result.update(b) + return result def merge_hash(a, b): ''' recursively merges hash b into a diff --git a/lib/ansible/vars/__init__.py b/lib/ansible/vars/__init__.py index 4eeedb1b05..8ceed9d3a2 100644 --- a/lib/ansible/vars/__init__.py +++ b/lib/ansible/vars/__init__.py @@ -121,7 +121,9 @@ class VariableManager: if C.DEFAULT_HASH_BEHAVIOUR == "merge": return self._merge_dicts(a, b) else: - return dict(a.items() + b.items()) + result = a.copy() + result.update(b) + return result def _merge_dicts(self, a, b): '''