Skip to content
Snippets Groups Projects
Commit 0abb97cf authored by Daniel Brown's avatar Daniel Brown
Browse files

fixing weakref updating on deepcopy for NodeGaussSetters

parent f415451c
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,7 @@ from pykat.SIfloat import *
from pykat.param import Param, AttrParam
import weakref
import pykat.exceptions as pkex
from copy import deepcopy
next_component_id = 1
from pykat import USE_GUI, NoGUIException
......
......@@ -424,6 +424,20 @@ class kat(object):
if kat_file != None:
self.loadKatFile(kat_file)
def __deepcopy__(self, memo):
cls = self.__class__
result = cls.__new__(cls)
memo[id(self)] = result
for k, v in self.__dict__.items():
setattr(result, k, copy.deepcopy(v, memo))
# Update any weakrefs
for c in result.components:
result.components[c]._Component__update_node_setters()
return result
@property
def signals(self): return self.__signals
......@@ -919,6 +933,7 @@ class kat(object):
r = katRun()
r.yaxis = self.yaxis
r.katScript = "".join(self.generateKatScript())
if (plot==None):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment