ipaldap: Convert dict items to list before iterating

In Python 3, dict.items() returns a view.
When such a view is iterated over, the dict cannot change size.

Part of the work for: https://fedorahosted.org/freeipa/ticket/4985

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Petr Viktorin 2016-05-06 18:12:02 +02:00 committed by Martin Basti
parent 25560f0e1d
commit c192c1ae3e

View File

@ -456,7 +456,7 @@ class LDAPEntry(collections.MutableMapping):
def __delitem__(self, name):
name = self._get_attr_name(name)
for (altname, keyname) in self._names.items():
for (altname, keyname) in list(self._names.items()):
if keyname == name:
del self._names[altname]