Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eeabe2a

Browse filesBrowse files
committed
gh-134062: Fix hash collisions in IPv4Network and IPv6Network
1 parent 74c4e35 commit eeabe2a
Copy full SHA for eeabe2a

File tree

2 files changed

+2
-1
lines changed
Filter options

2 files changed

+2
-1
lines changed

‎Lib/ipaddress.py

Copy file name to clipboardExpand all lines: Lib/ipaddress.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ def __eq__(self, other):
729729
return NotImplemented
730730

731731
def __hash__(self):
732-
return hash(int(self.network_address) ^ int(self.netmask))
732+
return hash((int(self.network_address), int(self.netmask)))
733733

734734
def __contains__(self, other):
735735
# always false if one is v4 and the other is v6.
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix hash collisions in :class:`IPv4Network` and :class:`IPv6Network`.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.