This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mjpieters
Recipients CosmicKid, cdirkx, mjpieters
Date 2021-05-18.11:30:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> Private is a subset of special use.  Should a "_special_use" constant be created.  This would include multicast, link_local, private_use, and a few more.

There are already dedicated tests for those other special use networks in ipaddress. is the block reserved for "IETF Protocol Assignments", which really means: private use. marks the block as "Not usable unless by virtue of a more specific reservation.".

The registry at lists those specific reservations, and only 2 to date are *globally reachable*, which means they are probably not private:

-, Port Control Protocol Anycast, RFC 7723
-, Traversal Using Relays around NAT Anycast, RFC 8155

I strongly feel that _any other IP address in the reserved range_ should be treated as private unless marked, by IANA, as globally reachable, at some future date.

That would require the list of networks for IPv4Address / IPv4Network is_private to include all of _minus those two exceptions_; calculating the network masks for these:

>>> def exclude_all(network, *excluded):
...     try:
...         for sub in network.address_exclude(excluded[0]):
...             yield from exclude_all(sub, *excluded[1:])
...     except (IndexError, ValueError):
...         yield network
>>> iana_reserved = IPv4Network("")
>>> to_remove = IPv4Network(""), IPv4Network("")

>>> for sub in exclude_all(iana_reserved, *to_remove):
...     print(sub)

The module could trivially do this on import, or we could hard-code the above list.
Date User Action Args
2021-05-18 11:30:22mjpieterssetrecipients: + mjpieters, cdirkx, CosmicKid
2021-05-18 11:30:22mjpieterssetmessageid: <>
2021-05-18 11:30:22mjpieterslinkissue42937 messages
2021-05-18 11:30:21mjpieterscreate