diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2009-06-02 05:29:37 +0000 |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2009-06-02 05:29:37 +0000 |
commit | 181bdc63741087bb43e299b0d3fa60b732894c7a (patch) | |
tree | 178d09f63215399752da46a5251f36c28dbeab1e /Lib/ipaddr.py | |
parent | b7ffad5b2837a3730a560d476487c1e10461cf7b (diff) | |
download | cpython-git-181bdc63741087bb43e299b0d3fa60b732894c7a.tar.gz |
Merged revisions 73135 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r73135 | gregory.p.smith | 2009-06-01 22:25:34 -0700 (Mon, 01 Jun 2009) | 3 lines
Fixes issue6169: it was possible for two ipaddr network addresses to compare
as both < and > than eachother.
........
Diffstat (limited to 'Lib/ipaddr.py')
-rw-r--r-- | Lib/ipaddr.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/Lib/ipaddr.py b/Lib/ipaddr.py index 96000af3cc..940741c17e 100644 --- a/Lib/ipaddr.py +++ b/Lib/ipaddr.py @@ -10,7 +10,7 @@ and prefixes. """ -__version__ = '1.1.0' +__version__ = '1.1.1' import struct @@ -206,17 +206,25 @@ class BaseIP(object): def __lt__(self, other): try: - return (self.version < other.version - or self.ip < other.ip - or self.netmask < other.netmask) + if self.version != other.version: + return self.version < other.version + if self.ip != other.ip: + return self.ip < other.ip + if self.netmask != other.netmask: + return self.netmask < other.netmask + return False except AttributeError: return NotImplemented def __gt__(self, other): try: - return (self.version > other.version - or self.ip > other.ip - or self.netmask > other.netmask) + if self.version != other.version: + return self.version > other.version + if self.ip != other.ip: + return self.ip > other.ip + if self.netmask != other.netmask: + return self.netmask > other.netmask + return False except AttributeError: return NotImplemented |