Skip to content

Commit ea1892f

Browse files
committed
Merge pull request #13 from bd808/issue/12
Avoid OverflowError with large ranges
2 parents f8c4fc6 + 0001199 commit ea1892f

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
language: python
22
python:
3-
- "2.5"
43
- "2.6"
54
- "2.7"
65
- "3.2"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Local documentation can be built using [Sphinx][]:
6464
Python Version Compatibility
6565
----------------------------
6666

67-
[Travis CI][ci-home] automatically runs tests against python 2.5, 2.6, 2.7, 3.2, 3.3 and pypy.
67+
[Travis CI][ci-home] automatically runs tests against python 2.6, 2.7, 3.2, 3.3 and pypy.
6868

6969
Installation
7070
------------

iptools/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ def __len__(self):
219219
2
220220
>>> len(IpRange('127/22'))
221221
1024
222+
>>> IpRange('fe80::/10').__len__() == 2**118
223+
True
222224
"""
223225
return self._len
224226
#end __len__
@@ -510,8 +512,10 @@ def __len__(self):
510512
256
511513
>>> len(IpRangeList('192.168.0.0/22'))
512514
1024
515+
>>> IpRangeList('fe80::/10').__len__() == 2**118
516+
True
513517
"""
514-
return sum([len(r) for r in self.ips])
518+
return sum(r.__len__() for r in self.ips)
515519
#end __len__
516520
#end class IpRangeList
517521

0 commit comments

Comments
 (0)