[entropy.client] fixes for "dictionary changed size during iteration"

This commit is contained in:
Sławomir Nizio
2019-12-18 22:20:29 +01:00
parent 47fc1e9f9a
commit 08da648a20
2 changed files with 4 additions and 3 deletions

View File

@@ -2564,8 +2564,8 @@ class MaskableRepository(EntropyRepositoryBase):
# if we get here, it means we didn't find a match in repositories
# so we scan packages, last chance
for keyword in keyword_pkg.keys():
# use .keys() because keyword_pkg gets modified during iteration
for keyword in list(keyword_pkg.keys()):
# use list() because keyword_pkg gets modified during iteration
# first of all check if keyword is in mykeywords
if keyword not in mykeywords:

View File

@@ -2855,7 +2855,8 @@ class CalculatorsMixin:
change = False
# now try to deeply remove unused packages
# iterate over a copy
for pkg_match in deep_dep_map.keys():
# list() because the dict gets modified in setup_revdeps()
for pkg_match in list(deep_dep_map.keys()):
deep_dep_map[pkg_match] -= flat_dep_tree
if (not deep_dep_map[pkg_match]) and \
(pkg_match not in flat_dep_tree):