-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
IP Interface is_unspecified broken #115766
Copy link
Copy link
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
Done
Bug report
Bug description:
Per the documentation, the IP interface classes inherit all properties from the associated address classes. As such,
is_unspecifiedis available as a property, although as implemented now, it will always returnFalsefor an interface.Given that an interface is just a network and host combined, it might be reasonable for the implementation of
is_unspecifiedto be something along the lines ofself.network.is_unspecified and self.ip.is_unspecifed, possibly implemented more efficiently (for exampleself._ip == 0 and self._prefixlen == 32for 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
Truecomparing an interface and address object.CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs