diff options
author | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-08-20 15:25:17 +0100 |
---|---|---|
committer | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-08-20 16:06:47 +0100 |
commit | e01bdf2432511b8bf51ecfd4fb46f140dbedae04 (patch) | |
tree | ae955051c612e62e49f3ac94788fcc8312d43d94 | |
parent | Kill the "_homeserver_" injected messages for room membership changes (diff) | |
download | synapse-e01bdf2432511b8bf51ecfd4fb46f140dbedae04.tar.xz |
Define __copy__ and __deepcopy__ as identity functions on DomainSpecificString, so that copy.deepcopy() will work on them
-rw-r--r-- | synapse/types.py | 8 |
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.""" |