summaryrefslogtreecommitdiffstats
path: root/ipapython
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2016-04-26 14:26:53 +0200
committerMartin Basti <mbasti@redhat.com>2016-04-28 16:22:07 +0200
commit05cb4ba4e97d8cbffaf1c16451c488db4a90a878 (patch)
treeb2f50615fc7e4cd0bd3222bb8162ee234b3bfbf8 /ipapython
parent28b0bfaefea02fe188b57b602396f5ef62863726 (diff)
downloadfreeipa-05cb4ba4e97d8cbffaf1c16451c488db4a90a878.tar.gz
freeipa-05cb4ba4e97d8cbffaf1c16451c488db4a90a878.tar.xz
freeipa-05cb4ba4e97d8cbffaf1c16451c488db4a90a878.zip
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>
Diffstat (limited to 'ipapython')
-rw-r--r--ipapython/sysrestore.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ipapython/sysrestore.py b/ipapython/sysrestore.py
index c1c2bce87..e0d090856 100644
--- a/ipapython/sysrestore.py
+++ b/ipapython/sysrestore.py
@@ -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]