From 168c10448b5142654b3e0be8fa2c21388d7e5b29 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Tue, 7 Apr 2015 23:59:36 +0200 Subject: [PATCH] models: Use copy.copy for creating copies --- mopidy/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mopidy/models.py b/mopidy/models.py index 45961f30..4f8ae6fe 100644 --- a/mopidy/models.py +++ b/mopidy/models.py @@ -1,5 +1,6 @@ from __future__ import absolute_import, unicode_literals +import copy import json # TODO: split into base models, serialization and fields? @@ -207,8 +208,7 @@ class ImmutableObject(object): :type values: dict :rtype: new instance of the model being copied """ - other = self.__class__() - other.__dict__.update(self.__dict__) + other = copy.copy(self) for key, value in values.items(): if key not in self._fields: raise TypeError(