Skip to content

Commit

Permalink
Added deepcopy to instance container
Browse files Browse the repository at this point in the history
I suspect the default deepcopy causing the recursion issues. By explicitly defining a deep copy, it should also provide better tracebacks

CURA-3575
  • Loading branch information
nallath committed Mar 30, 2017
1 parent 10a6d12 commit bfe0ba9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions UM/Settings/InstanceContainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ def __hash__(self):
# the same hash. The way we use it, it is acceptable for objects with the same value to return a different hash.
return id(self)

def __deepcopy__(self, memo):
new_container = self.__class__(self._id)
new_container._name = self._name
new_container._definition = self._definition
new_container._metadata = copy.deepcopy(self._metadata, memo)
new_container._instances = copy.deepcopy(self._instances, memo)
new_container._read_only = self._read_only
new_container._dirty = self._dirty
new_container._path = copy.deepcopy(self._path, memo)
new_container._cached_values = copy.deepcopy(self._cached_values, memo)
return new_container

def __eq__(self, other):
self._instantiateCachedValues()
if type(self) != type(other):
Expand Down

0 comments on commit bfe0ba9

Please sign in to comment.