Skip to content

Commit

Permalink
Cast flags and ednsflags to int when calling dns.rcode.from_flags() and
Browse files Browse the repository at this point in the history
dns.opcode.from_flags().  This avoids subsequent to_text issues and other
type confusion if the values were allowed to remain IntFlags.
  • Loading branch information
rthalley committed Jan 4, 2021
1 parent 14bbb9c commit 5103169
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dns/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def rcode(self):
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.
Expand All @@ -690,7 +690,7 @@ def opcode(self):
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.
Expand Down

0 comments on commit 5103169

Please sign in to comment.