summaryrefslogtreecommitdiff
path: root/dns/name.py
diff options
context:
space:
mode:
authorBob Halley <halley@play-bow.org>2015-12-03 09:17:10 -0800
committerBob Halley <halley@play-bow.org>2015-12-03 09:17:10 -0800
commit62bcfe252523527ca4ece8a9a8b2e7815327bd3a (patch)
tree0a591102caf194718b9eff49c8c4cbf61cf5f710 /dns/name.py
parent8d07796fb6fa744f4f528268466d1a09fe5204aa (diff)
parentc2180f890079a1e8a7b93aff3c2517ca1688a584 (diff)
downloaddnspython-62bcfe252523527ca4ece8a9a8b2e7815327bd3a.tar.gz
Merge pull request #102 from encukou/py3-pickle
Py3: Implement the pickle protocol for Name objects
Diffstat (limited to 'dns/name.py')
-rw-r--r--dns/name.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/dns/name.py b/dns/name.py
index 44af098..0c1d4ab 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