mirror of https://github.com/ansible/ansible.git
GH-56902 Copy to new list from dict.items() return
dict.items() in pytho2 returns a list of tuples which can be iterated while modifying the dict. In python 3 it returns a view which is tied to the underlying dict, meaning the modifications to the dict while iterating are unsafe. This commit generates new list containing the tuples from the iterator in python 3 which breaks the link to the dict, allowing the dict to be modified while iterating the list. In python 2 it would simply copy the list. Fixes #56902pull/57028/head
parent
a946d5d8ce
commit
0d75e2659e
Loading…
Reference in New Issue