From 7b6ebf77c3ace2bc502a2b142a28a0c2540deece Mon Sep 17 00:00:00 2001 From: bastiak Date: Thu, 20 Feb 2014 13:41:15 +0100 Subject: [PATCH] Allows to copy dns.name.Name objects --- dns/name.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dns/name.py b/dns/name.py index 3d3b1bed..29489982 100644 --- a/dns/name.py +++ b/dns/name.py @@ -25,6 +25,7 @@ import encodings.idna import io import struct import sys +import copy import dns.exception import dns.util @@ -156,6 +157,12 @@ class Name(object): def __setattr__(self, name, value): raise TypeError("object doesn't support attribute assignment") + def __copy__(self): + return Name(self.labels) + + def __deepcopy__(self, memo): + return Name(copy.deepcopy(self.labels, memo)) + def is_absolute(self): """Is the most significant label of this name the root label? @rtype: bool -- 2.47.3