From 46b0c57f01534776e3e39e2addfab85c5d0703bb Mon Sep 17 00:00:00 2001 From: Andreas Freise <adf@star.bham.ac.uk> Date: Fri, 10 Apr 2015 23:29:54 +0100 Subject: [PATCH] adding deepcopy fix to new branch --- pykat/components.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pykat/components.py b/pykat/components.py index 8cd8c81..f21bb74 100644 --- a/pykat/components.py +++ b/pykat/components.py @@ -209,6 +209,19 @@ class Component(object): del self._params[:] self.__removed = True + + 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, deepcopy(v, memo)) + + for p in result._params: + p._updateOwner(result) + + return result class AbstractMirrorComponent(Component): __metaclass__ = abc.ABCMeta -- GitLab