-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Description
Bug report
Bug description:
from ipaddress import ip_interface
ip_interface('0.0.0.0/32').is_unspecified == False
ip_interface('0.0.0.0/32').network.is_unspecified == True
ip_interface('0.0.0.0/32').ip.is_unspecified == True
Per the documentation, the IP interface classes inherit all properties from the associated address classes. As such, is_unspecified
is available as a property, although as implemented now, it will always return False
for an interface.
Given that an interface is just a network and host combined, it might be reasonable for the implementation of is_unspecified
to be something along the lines of self.network.is_unspecified and self.ip.is_unspecifed
, possibly implemented more efficiently (for example self._ip == 0 and self._prefixlen == 32
for IPv4)
The current implementation isn't specified for an interface, so it falls back to the address implementation which checks if the address equals '0.0.0.0', although this subtly always fails because the interface equality function is used which will never return True
comparing an interface and address object.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux