summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2020-05-27 13:36:03 -0700
committerGitHub <noreply@github.com>2020-05-27 13:36:03 -0700
commitc3c14141b63cd14030ef5588b079d5058d23dbb4 (patch)
tree3f55423e4ed81465ef889f2333d394b614c4d9c0
parentf952afd92b0aa75fd59f6cb187d76a4ae0dffd16 (diff)
parenta4e3eca5c4361f89061e43458034fe0ef6284b62 (diff)
downloaddnspython-c3c14141b63cd14030ef5588b079d5058d23dbb4.tar.gz
Merge pull request #487 from pspacek/pickle_rdata
make rdata objects picklable again
-rw-r--r--dns/rdata.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/dns/rdata.py b/dns/rdata.py
index 6f246c2..b8d65f1 100644
--- a/dns/rdata.py
+++ b/dns/rdata.py
@@ -127,6 +127,13 @@ class Rdata(object):
# Rdatas are immutable
raise TypeError("object doesn't support attribute deletion")
+ def __getstate__(self):
+ return tuple(getattr(self, slot) for slot in self.__slots__)
+
+ def __setstate__(self, state):
+ for slot, val in zip(self.__slots__, state):
+ object.__setattr__(self, slot, val)
+
def covers(self):
"""Return the type a Rdata covers.