From 615234a10dc47a5cb9c6286c411105be8e2d80b8 Mon Sep 17 00:00:00 2001 From: roopa Date: Wed, 7 May 2014 23:20:04 -0700 Subject: [PATCH] make a copy of the indegrees dict in the graph module Ticket: CM-2731 Reviewed By: Testing Done: Tested ifupdown sanity The graph module modifies the indegrees array and so introduce a copy of the dict before modifying it. --- pkg/graph.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/graph.py b/pkg/graph.py index 40c834a..cb2db86 100644 --- a/pkg/graph.py +++ b/pkg/graph.py @@ -8,6 +8,7 @@ # import logging +import copy from collections import deque try: from gvgen import * @@ -21,10 +22,11 @@ class graph(): self.__class__.__name__) @classmethod - def topological_sort_graphs_all(cls, dependency_graphs, indegrees): + def topological_sort_graphs_all(cls, dependency_graphs, indegrees_arg): S = [] Q = deque() + indegrees = copy.deepcopy(indegrees_arg) for ifname,indegree in indegrees.items(): if indegree == 0: Q.append(ifname)