]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Cast flags and ednsflags to int when calling dns.rcode.from_flags() and
authorBob Halley <halley@dnspython.org>
Mon, 4 Jan 2021 21:49:50 +0000 (13:49 -0800)
committerBob Halley <halley@dnspython.org>
Mon, 4 Jan 2021 21:49:50 +0000 (13:49 -0800)
dns.opcode.from_flags().  This avoids subsequent to_text issues and other
type confusion if the values were allowed to remain IntFlags.

dns/message.py

index ac88837987d27748afc163de3da58b4ef7af3976..131f1f3f00b2f0e850f77c509f8bb17ecd56d19c 100644 (file)
@@ -672,7 +672,7 @@ class Message:
 
         Returns an ``int``.
         """
-        return dns.rcode.from_flags(self.flags, self.ednsflags)
+        return dns.rcode.from_flags(int(self.flags), int(self.ednsflags))
 
     def set_rcode(self, rcode):
         """Set the rcode.
@@ -690,7 +690,7 @@ class Message:
 
         Returns an ``int``.
         """
-        return dns.opcode.from_flags(self.flags)
+        return dns.opcode.from_flags(int(self.flags))
 
     def set_opcode(self, opcode):
         """Set the opcode.