fix RuntimeError: dictionary changed size during iteration

This commit is contained in:
Kelly Anderson committed 2019-06-22 18:11:36 -06:00
1 parent 4b04e8fd79
commit 1c3e463ac6
1 file changed
+3 -1
+3 -1
View File
@@ -525,7 +525,9 @@ def _delete_chamber(x):
def _delete_from_data(x, key_matcher):
data = dict(x)
for k in data.keys():
# must make list of keys first to avoid
# RuntimeError: dictionary changed size during iteration
for k in list(data.keys()):
if key_matcher(k):
del data[k]
return data