summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-23 12:12:30 (GMT)
committerWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-25 06:43:13 (GMT)
commita51e9c21716144729d9ac2a982706915dd285529 (patch)
tree883a019eee88dfe13f210c0bca9d56faad46008f
parent13f890e8a64f3808a182ad3039139f8421b46e53 (diff)
fix RuntimeError: dict changed size during iteration
-rwxr-xr-xsrc/kajonggtest.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/kajonggtest.py b/src/kajonggtest.py
index b456568..c6f355d 100755
--- a/src/kajonggtest.py
+++ b/src/kajonggtest.py
@@ -88,14 +88,15 @@ class Clone(object):
@classmethod
def removeUnused(cls):
"""remove clones we do not use anymore"""
- for commitId in cls.clones.keys():
+ for commitId in list(cls.clones.keys()):
+ # guard against "dict changed size during iteration
if not any(x.commitId == commitId for x in Server.servers):
cls.clones[commitId].remove()
@classmethod
def removeAll(cls):
"""remove all clones even if they are in use"""
- for cloneKey in cls.clones.keys()[:]:
+ for cloneKey in list(cls.clones.keys()):
cls.clones[cloneKey].remove()