Skip to content

Commit

Permalink
Remove hash value truncation.
Browse files Browse the repository at this point in the history
There's no need to truncate the result of __hash__(); the runtime will
already truncate it to sys.hash_info.width.
  • Loading branch information
bwelling committed May 20, 2020
1 parent 057015c commit 119e324
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions dns/name.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import copy
import struct
import sys

import encodings.idna # type: ignore
try:
Expand All @@ -32,8 +31,6 @@
import dns.exception
import dns.wiredata

maxint = sys.maxsize

# fullcompare() result values

#: The compared names have no relationship to each other.
Expand Down Expand Up @@ -370,7 +367,7 @@ def __hash__(self):
for label in self.labels:
for c in label.lower():
h += (h << 3) + c
return h % maxint
return h

def fullcompare(self, other):
"""Compare two names, returning a 3-tuple
Expand Down

0 comments on commit 119e324

Please sign in to comment.