From: Bob Halley Date: Thu, 26 Feb 2015 14:04:26 +0000 (-0800) Subject: Implement the pickle protocol. X-Git-Tag: v1.13.0~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d52fda5e2d887301e748ca9ac3e7dd6b5ffda25;p=thirdparty%2Fdnspython.git Implement the pickle protocol. --- diff --git a/dns/name.py b/dns/name.py index 55c3fde0..9e17cddf 100644 --- a/dns/name.py +++ b/dns/name.py @@ -152,6 +152,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