Iterate over a copy of the digraph nodes so that removal can't break
authorZac Medico <zmedico@gentoo.org>
Thu, 10 Apr 2008 09:11:22 +0000 (09:11 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 10 Apr 2008 09:11:22 +0000 (09:11 -0000)
the iterator.

svn path=/main/trunk/; revision=9799

pym/_emerge/__init__.py

index 6eae62d11bdcb593ed9849a073910fb8ebf3ba02..f99ba7bcd968a302602f3d86625525610763116d 100644 (file)
@@ -7132,7 +7132,7 @@ def action_build(settings, trees, mtimedb,
                                return retval
                        if "--buildpkgonly" in myopts:
                                graph_copy = mydepgraph.digraph.clone()
-                               for node in graph_copy.order:
+                               for node in list(graph_copy.order):
                                        if not isinstance(node, Package):
                                                graph_copy.remove(node)
                                if not graph_copy.hasallzeros(ignore_priority=DepPriority.MEDIUM):
@@ -7142,7 +7142,7 @@ def action_build(settings, trees, mtimedb,
        else:
                if "--buildpkgonly" in myopts:
                        graph_copy = mydepgraph.digraph.clone()
-                       for node in graph_copy.order:
+                       for node in list(graph_copy.order):
                                if not isinstance(node, Package):
                                        graph_copy.remove(node)
                        if not graph_copy.hasallzeros(ignore_priority=DepPriority.MEDIUM):