Bug description:
_BaseNetwork.next_network() guards address-space exhaustion with except OverflowError, which only the IPv4 path raises, so on IPv6 the internal ValueError from _string_from_ip_int() escapes instead.
from ipaddress import IPv4Network, IPv6Network
for net in (IPv4Network('255.255.255.0/24'),
IPv6Network('ffff:ffff:ffff:ffff:ffff:ffff:ffff:0/112')):
try:
net.next_network()
except ValueError as e:
print(f"{net}: {e}")
Output:
255.255.255.0/24: out of address space, cannot make another /24 network
ffff:ffff:ffff:ffff:ffff:ffff:ffff:0/112: IPv6 address is too large
Expected: out of address space, cannot make another /112 network, the message Doc/library/ipaddress.rst gives for next_network().
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Bug description:
_BaseNetwork.next_network()guards address-space exhaustion withexcept OverflowError, which only the IPv4 path raises, so on IPv6 the internalValueErrorfrom_string_from_ip_int()escapes instead.Output:
Expected:
out of address space, cannot make another /112 network, the messageDoc/library/ipaddress.rstgives fornext_network().CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs