From: Brian Wellington Date: Thu, 10 Apr 2025 22:21:11 +0000 (-0700) Subject: Fix want_dnssec semantics. X-Git-Tag: v2.8.0rc1~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2067a5920f71fb27900be0f86851a931b819b1f;p=thirdparty%2Fdnspython.git Fix want_dnssec semantics. Calling dns.message.make_query() with ednsflags including dns.flags.DO didn't work properly. The code would call Message.use_edns(), which would do the right thing, and then call Message.want_dnssec(false) because want_dnssec defaults False, which would overwrite the flags with the wrong value. This slightly changes the semantics, to make want_dnssec only have an effect if it's True. That's already what the documentation says. --- diff --git a/dns/message.py b/dns/message.py index c655b02c..1288b205 100644 --- a/dns/message.py +++ b/dns/message.py @@ -1837,7 +1837,8 @@ def make_query( kwargs["edns"] = use_edns kwargs["pad"] = pad m.use_edns(**kwargs) - m.want_dnssec(want_dnssec) + if want_dnssec: + m.want_dnssec(want_dnssec) return m