You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pythonGH-113171: Fix "private" (really non-global) IP address ranges
The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).
This patch updates the ranges with what was missing or otherwise
incorrect.
A _address_exclude_many() helper function is created to calculate
the necessary network ranges in the trickier cases.
I left 100.64.0.0/10 alone, for now, as it's been made special in [1]
and I'm not sure if we want to undo that as I don't quite understand the
motivation behind it.
Additionally I mainly focused on adding tests for IP*Address.is_global
and I left IP*Network.is_global alone. The reasons for that are:
* I don't think it makes much sense to have properties like is_global,
is_private etc. on networks, where there are more than two
possibilities (can be global, can be non-global, can be partially global).
* The properties aren't documented for network objects in the first
place so it's unclear what the semantics are
The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.
[1] python#61602
0 commit comments