From a487b700e87c67ad7bc40d631d225c2d3c485fed Mon Sep 17 00:00:00 2001 From: Sree Vaddi <441385+sreev@users.noreply.github.com> Date: Wed, 17 Jun 2020 16:51:59 -0700 Subject: [PATCH] [https://bugs.python.org/issue41004] Hash collisions --- Lib/ipaddress.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py index 6e5a754c2acf1e..75b4c352c1d257 100644 --- a/Lib/ipaddress.py +++ b/Lib/ipaddress.py @@ -1420,7 +1420,7 @@ def __lt__(self, other): return False def __hash__(self): - return self._ip ^ self._prefixlen ^ int(self.network.network_address) + return hash((self._ip, self._prefixlen, int(self.network.network_address))) __reduce__ = _IPAddressBase.__reduce__ @@ -2120,7 +2120,7 @@ def __lt__(self, other): return False def __hash__(self): - return self._ip ^ self._prefixlen ^ int(self.network.network_address) + return hash((self._ip, self._prefixlen, int(self.network.network_address))) __reduce__ = _IPAddressBase.__reduce__