[Python-Dev] Request for comments: [issue22941] IPv4Interface arithmetic changes subnet mask
Eric V. Smith
eric at trueblade.com
Thu Mar 12 15:46:34 CET 2015
On 3/12/2015 10:00 AM, Antoine Pitrou wrote:
> On Thu, 12 Mar 2015 12:37:16 +0000
> "Loevborg, Soeren Jakob" <soeren.j.loevborg at siemens.com> wrote:
>>
>>>>> import ipaddress
>>>>> ipaddress.IPv4Interface('10.0.0.1/8') + 1
>> IPv4Interface('10.0.0.2/32')
>>>>> ipaddress.IPv6Interface('fd00::1/64') + 1
>> IPv6Interface('fd00::2/128')
>
> Given that the behaviour is unlikely to match any use case, I'd say
> it's a bug.
Agreed.
> Related issue:
>
>>>> ipaddress.IPv4Interface('10.0.0.255/8') + 1
> IPv4Interface('10.0.1.0/32')
>
> Should the result be IPv4Interface('10.0.0.0/8')
> (i.e. wrap around)? Should OverflowError be raised?
I think it should be an OverflowError. 10.0.1.0/8 makes no sense, and
10.0.0.0/8 is unlikely to be desirable.
--
Eric.
More information about the Python-Dev
mailing list