diff --git a/lisa/utils.py b/lisa/utils.py index c97f8449e8a200e6117875804f8cfcf3eac03b12..067768f93a377b81de7155c34ad908348512c1ad 100644 --- a/lisa/utils.py +++ b/lisa/utils.py @@ -468,10 +468,17 @@ class Serializable(Loggable): self.__dict__ = dct def __copy__(self): - """Make sure that copying the class still works as usual, without - dropping some attributes by defining __copy__ - """ - return super().__copy__() + """ + Make sure that copying the class still works as usual, without + dropping some attributes by defining __copy__ + """ + try: + return super().__copy__() + except AttributeError: + cls = self.__class__ + new = cls.__new__(cls) + new.__dict__.update(self.__dict__) + return new Serializable._init_yaml()