New submission from Søren Løvborg:

Addition and subtraction of integers are documented for ipaddress.IPv4Address 
and ipaddress.IPv6Address, but also work for IPv4Interface and IPv6Interface 
(though the only documentation of this is a brief mention that the Interface 
classes inherit from the respective Address classes). That's good.

The problem is that adding/subtracting an integer to an Interface object 
changes the subnet mask (to max_prefixlen), something which is 1) not 
documented and 2) not the least surprising result.

>>> 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')

Changing this breaks backwards compatibility; though since the ipaddress module 
was provisional until recently and the behavior is undocumented, I hope it's 
not too late to change.

----------
components: Library (Lib)
messages: 231670
nosy: kwi.dk
priority: normal
severity: normal
status: open
title: IPv4Interface arithmetic changes subnet mask
type: behavior

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22941>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to