mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
sysrestore: Iterate over a list of dict keys
In Python 3, dict.keys() returns a key view. It is not safe to delete dict keys when iterating over this view. Convert the keys to list first. Part of the work for https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
parent
28b0bfaefe
commit
05cb4ba4e9
@ -347,7 +347,7 @@ class StateFile:
|
||||
"""
|
||||
root_logger.debug("Saving StateFile to '%s'", self._path)
|
||||
|
||||
for module in self.modules.keys():
|
||||
for module in list(self.modules.keys()):
|
||||
if len(self.modules[module]) == 0:
|
||||
del self.modules[module]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user