summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2021-10-14 09:37:54 -0700
committerBob Halley <halley@dnspython.org>2021-10-14 09:37:54 -0700
commit56e2a3a1f7248cde6e4a0729d6ab226057706a43 (patch)
tree0d713dffcec2b93f96c1eb791ff9e7759dfb7f19
parentc80d40a8b9b5788f98af9782afb72f09c00e268a (diff)
downloaddnspython-cmp_fix.tar.gz
_cmp() raised NoRelativeRdataOrdering in abs vs. abs casecmp_fix
-rw-r--r--dns/rdata.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/dns/rdata.py b/dns/rdata.py
index 1917ecd..624063e 100644
--- a/dns/rdata.py
+++ b/dns/rdata.py
@@ -264,13 +264,15 @@ class Rdata:
our = self.to_digestable()
our_relative = False
except dns.name.NeedAbsoluteNameOrOrigin:
- our = self.to_digestable(dns.name.root)
+ if _allow_relative_comparisons:
+ our = self.to_digestable(dns.name.root)
our_relative = True
try:
their = other.to_digestable()
their_relative = False
except dns.name.NeedAbsoluteNameOrOrigin:
- their = other.to_digestable(dns.name.root)
+ if _allow_relative_comparisons:
+ their = other.to_digestable(dns.name.root)
their_relative = True
if _allow_relative_comparisons:
if our_relative != their_relative:
@@ -280,7 +282,7 @@ class Rdata:
return -1
else:
return 1
- else:
+ elif our_relative or their_relative:
raise NoRelativeRdataOrdering
if our == their:
return 0