@@ -310,7 +310,7 @@ def collapse_addresses(addresses):
310310 [IPv4Network('192.0.2.0/24')]
311311
312312 Args:
313- addresses: An iterator of IPv4Network or IPv6Network objects.
313+ addresses: An iterable of IPv4Network or IPv6Network objects.
314314
315315 Returns:
316316 An iterator of the collapsed IPv(4|6)Network objects.
@@ -1840,9 +1840,6 @@ def _string_from_ip_int(cls, ip_int=None):
18401840 def _explode_shorthand_ip_string (self ):
18411841 """Expand a shortened IPv6 address.
18421842
1843- Args:
1844- ip_str: A string, the IPv6 address.
1845-
18461843 Returns:
18471844 A string, the expanded IPv6 address.
18481845
@@ -2100,6 +2097,9 @@ def is_loopback(self):
21002097 RFC 2373 2.5.3.
21012098
21022099 """
2100+ ipv4_mapped = self .ipv4_mapped
2101+ if ipv4_mapped is not None :
2102+ return ipv4_mapped .is_loopback
21032103 return self ._ip == 1
21042104
21052105 @property
@@ -2216,7 +2216,7 @@ def is_unspecified(self):
22162216
22172217 @property
22182218 def is_loopback (self ):
2219- return self . _ip == 1 and self .network .is_loopback
2219+ return super (). is_loopback and self .network .is_loopback
22202220
22212221
22222222class IPv6Network (_BaseV6 , _BaseNetwork ):
@@ -2329,6 +2329,8 @@ class _IPv6Constants:
23292329 IPv6Network ('2001:db8::/32' ),
23302330 # IANA says N/A, let's consider it not globally reachable to be safe
23312331 IPv6Network ('2002::/16' ),
2332+ # RFC 9637: https://www.rfc-editor.org/rfc/rfc9637.html#section-6-2.2
2333+ IPv6Network ('3fff::/20' ),
23322334 IPv6Network ('fc00::/7' ),
23332335 IPv6Network ('fe80::/10' ),
23342336 ]
0 commit comments