summaryrefslogtreecommitdiffstats
path: root/Lib/ipaddress.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-03-01 08:25:45 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-03-01 08:25:45 (GMT)
commitbb0dbd583bdac8f1bfb9f0a45e7014b2663d5729 (patch)
tree9b5216a037577f95eac9a26ab2298d236cef7709 /Lib/ipaddress.py
parent5f582bdec8dee935b7d14d71fce869e0dd692061 (diff)
downloadcpython-bb0dbd583bdac8f1bfb9f0a45e7014b2663d5729.zip
cpython-bb0dbd583bdac8f1bfb9f0a45e7014b2663d5729.tar.gz
cpython-bb0dbd583bdac8f1bfb9f0a45e7014b2663d5729.tar.bz2
Issue #26457: Fixed the subnets() methods in IP network classes for the case
when resulting prefix length is equal to maximal prefix length. Based on patch by Xiang Zhang.
Diffstat (limited to 'Lib/ipaddress.py')
-rw-r--r--Lib/ipaddress.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py
index 7469a9d..ca3031a 100644
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -740,21 +740,21 @@ class _BaseNetwork(_IPAddressBase):
addr1 = ip_network('192.0.2.0/28')
addr2 = ip_network('192.0.2.1/32')
- addr1.address_exclude(addr2) =
+ list(addr1.address_exclude(addr2)) =
[IPv4Network('192.0.2.0/32'), IPv4Network('192.0.2.2/31'),
- IPv4Network('192.0.2.4/30'), IPv4Network('192.0.2.8/29')]
+ IPv4Network('192.0.2.4/30'), IPv4Network('192.0.2.8/29')]
or IPv6:
addr1 = ip_network('2001:db8::1/32')
addr2 = ip_network('2001:db8::1/128')
- addr1.address_exclude(addr2) =
+ list(addr1.address_exclude(addr2)) =
[ip_network('2001:db8::1/128'),
- ip_network('2001:db8::2/127'),
- ip_network('2001:db8::4/126'),
- ip_network('2001:db8::8/125'),
- ...
- ip_network('2001:db8:8000::/33')]
+ ip_network('2001:db8::2/127'),
+ ip_network('2001:db8::4/126'),
+ ip_network('2001:db8::8/125'),
+ ...
+ ip_network('2001:db8:8000::/33')]
Args:
other: An IPv4Network or IPv6Network object of the same type.
@@ -916,7 +916,7 @@ class _BaseNetwork(_IPAddressBase):
new_prefixlen, self))
start = int(self.network_address)
- end = int(self.broadcast_address)
+ end = int(self.broadcast_address) + 1
step = (int(self.hostmask) + 1) >> prefixlen_diff
for new_addr in range(start, end, step):
current = self.__class__((new_addr, new_prefixlen))