bpo-29931 fix lt check in ipaddress.ip_interface for both v4 and v6. by s-sanjay · Pull Request #879 · python/cpython (original) (raw)
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation11 Commits6 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
the original logic was just comparing the network address
but this is wrong because if the network address is equal then
we need to compare the ip address for breaking the tie
add more ip_interface comparison tests
Hello, and thanks for your contribution!
I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).
Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA. This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.
Thanks again to your contribution and we look forward to looking at it!
@@ -1410,11 +1410,17 @@ def __lt__(self, other): |
---|
if address_less is NotImplemented: |
return NotImplemented |
try: |
return self.network < other.network |
network_less = self.network < other.network |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be written simpler as:
return (self.network < other.network or self.network == other.network and address_less)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the code.
the original logic was just comparing the network address but this is wrong because if the network address is equal then we need to compare the ip address for breaking the tie
add more ip_interface comparison tests
Please add an entry in Misc/NEWS
(at the start of the "Library" section). Don't forget to add "Patch by ."
sanjay and others added 2 commits
@s-sanjay We can't merge your PR unless you signed the CLA.
Once signed, please also make sure that your GitHub username is linked to your user info in bugs.python.org. Please read the devguide for more info.
Thanks :)
The sign on the tracker means that Sanjay signed the CLA. That is why I manually changed the label. But he make an error in his GitHub name, sanjay-s instead of s-sanjay.
@@ -316,6 +319,7 @@ Library |
---|
- bpo-25996: Added support of file descriptors in os.scandir() on Unix. |
os.fwalk() is sped up by 2 times by using os.scandir(). |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant empty line.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this pull request
…4 and v6. (pythonGH-879)
the original logic was just comparing the network address but this is wrong because if the network address is equal then we need to compare the ip address for breaking the tie
add more ip_interface comparison tests. (cherry picked from commit 7bd8d3e)
serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this pull request
…4 and v6. (pythonGH-879)
the original logic was just comparing the network address but this is wrong because if the network address is equal then we need to compare the ip address for breaking the tie
add more ip_interface comparison tests. (cherry picked from commit 7bd8d3e)
serhiy-storchaka added a commit that referenced this pull request
the original logic was just comparing the network address but this is wrong because if the network address is equal then we need to compare the ip address for breaking the tie
add more ip_interface comparison tests. (cherry picked from commit 7bd8d3e)
serhiy-storchaka added a commit that referenced this pull request
the original logic was just comparing the network address but this is wrong because if the network address is equal then we need to compare the ip address for breaking the tie
add more ip_interface comparison tests. (cherry picked from commit 7bd8d3e)
Labels
An unexpected behavior, bug, or error