Skip to content
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 and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix comparison with large IPSet() #56

Merged
merged 2 commits into from
Feb 25, 2014
Merged

Fix comparison with large IPSet() #56

merged 2 commits into from
Feb 25, 2014

Conversation

2xyo
Copy link
Contributor

@2xyo 2xyo commented Jul 18, 2013

__lt__ and __gt__ use len()

>>> a = IPSet(['fc00::/7'])
>>> b = IPSet(['fe80::/10'])
>>> a < b
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/yohann/netaddr_play/src/netaddr/netaddr/ip/sets.py", line 425, in __lt__
    return len(self) < len(other) and self.issubset(other)
  File "/home/yohann/netaddr_play/src/netaddr/netaddr/ip/sets.py", line 614, in __len__
    "IP addresses! Use the .size property instead." % _sys_maxint)
IndexError: range contains greater than 2147483647 (maxint) IP addresses! Use the .size property instead.

This fix replaces len() with the .size attribute.

snordhausen pushed a commit that referenced this pull request Feb 25, 2014
Fix comparaison with large IPSet()
@snordhausen snordhausen merged commit 672edb0 into netaddr:rel-0.7.x Feb 25, 2014
@snordhausen snordhausen modified the milestone: 0.7.11 Feb 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants