Fix digraph.clone() to properly clone priority lists.
authorZac Medico <zmedico@gentoo.org>
Thu, 5 Feb 2009 23:02:36 +0000 (23:02 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 5 Feb 2009 23:02:36 +0000 (23:02 -0000)
svn path=/main/trunk/; revision=12587

pym/portage/__init__.py

index 85c970440d9dad8ced9d18d266ac5314f277d8a4..5ac305817f3ffd1253881c1b44f0978eba9640e0 100644 (file)
@@ -561,8 +561,14 @@ class digraph(object):
        def clone(self):
                clone = digraph()
                clone.nodes = {}
-               for k, v in self.nodes.iteritems():
-                       clone.nodes[k] = (v[0].copy(), v[1].copy(), v[2])
+               for children, parents, node in self.nodes.itervalues():
+                       children_clone = {}
+                       for child, priorities in children.iteritems():
+                               children_clone[child] = priorities[:]
+                       parents_clone = {}
+                       for parent, priorities in parents.iteritems():
+                               parents_clone[parent] = priorities[:]
+                       clone.nodes[node] = (children_clone, parents_clone, node)
                clone.order = self.order[:]
                return clone