From 44734dc05993d9ec19569b64b75af7de06e52c81 Mon Sep 17 00:00:00 2001 From: Dave Vandenbout Date: Sat, 6 Jul 2019 10:17:51 -0400 Subject: [PATCH] python: Return copy of netclasses not reference Fix Board.GetAllNetClasses() so it no longer creates a duplicate of the Default netclass in the design rules net classes list. Fixes: lp:1803623 * https://bugs.launchpad.net/kicad/+bug/1803623 --- pcbnew/swig/board.i | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pcbnew/swig/board.i b/pcbnew/swig/board.i index 91c41cc90a..3bdc1e610c 100644 --- a/pcbnew/swig/board.i +++ b/pcbnew/swig/board.i @@ -173,11 +173,10 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints) GetNetClasses(BOARD self) -> { wxString net_class_name : NETCLASSPTR } Include the "Default" netclass also. """ - netclassmap = self.GetNetClasses().NetClasses() - # Add the Default one too, but this is probably modifying the NETCLASS_MAP - # in the BOARD. If that causes trouble, could make a deepcopy() here first. - # netclassmap = deepcopy(netclassmap) + # Copy the NETCLASS_MAP so the one in the BOARD isn't modified + # when we add the Default net class. + netclassmap = {k:v for k,v in self.GetNetClasses().NetClasses().items()} netclassmap['Default'] = self.GetNetClasses().GetDefault() return netclassmap %}