From: Bob Halley Date: Thu, 26 Feb 2015 14:04:26 +0000 (-0800) Subject: Implement the pickle protocol. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e9995e78d273b2123d920018134ae884b5a4ce5;p=thirdparty%2Fdnspython.git Implement the pickle protocol. --- diff --git a/dns/name.py b/dns/name.py index 44af0985..0c1d4abe 100644 --- a/dns/name.py +++ b/dns/name.py @@ -168,6 +168,13 @@ class Name(object): def __deepcopy__(self, memo): return Name(copy.deepcopy(self.labels, memo)) + def __getstate__(self): + return { 'labels' : self.labels } + + def __setstate__(self, state): + super(Name, self).__setattr__('labels', state['labels']) + _validate_labels(self.labels) + def is_absolute(self): """Is the most significant label of this name the root label? @rtype: bool