From 6d52fda5e2d887301e748ca9ac3e7dd6b5ffda25 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Thu, 26 Feb 2015 06:04:26 -0800 Subject: [PATCH] Implement the pickle protocol. --- dns/name.py | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- 2.47.3