summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <paul@matrix.org>2014-08-20 15:25:17 +0100
committerPaul "LeoNerd" Evans <paul@matrix.org>2014-08-20 16:06:47 +0100
commite01bdf2432511b8bf51ecfd4fb46f140dbedae04 (patch)
treeae955051c612e62e49f3ac94788fcc8312d43d94 /synapse
parentKill the "_homeserver_" injected messages for room membership changes (diff)
downloadsynapse-e01bdf2432511b8bf51ecfd4fb46f140dbedae04.tar.xz
Define __copy__ and __deepcopy__ as identity functions on DomainSpecificString, so that copy.deepcopy() will work on them
Diffstat (limited to 'synapse')
-rw-r--r--synapse/types.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/types.py b/synapse/types.py
index b8e191bb3c..fd6a3d1d72 100644
--- a/synapse/types.py
+++ b/synapse/types.py
@@ -38,6 +38,14 @@ class DomainSpecificString(
     def __iter__(self):
         raise ValueError("Attempted to iterate a %s" % (type(self).__name__))
 
+    # Because this class is a namedtuple of strings and booleans, it is deeply
+    # immutable.
+    def __copy__(self):
+        return self
+
+    def __deepcopy__(self, memo):
+        return self
+
     @classmethod
     def from_string(cls, s, hs):
         """Parse the string given by 's' into a structure object."""