diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py index f1062a8cd052a5..7925f4034f1635 100644 --- a/Lib/ipaddress.py +++ b/Lib/ipaddress.py @@ -2387,6 +2387,10 @@ class _IPv6Constants: IPv6Network('2002::/16'), # RFC 9637: https://www.rfc-editor.org/rfc/rfc9637.html#section-6-2.2 IPv6Network('3fff::/20'), + # RFC 9602: https://www.rfc-editor.org/rfc/rfc9602.html + IPv6Network('5f00::/16'), + # RFC 9780: https://www.rfc-editor.org/rfc/rfc9780.html + IPv6Network('100:0:0:1::/64'), IPv6Network('fc00::/7'), IPv6Network('fe80::/10'), ] diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py index 3f017b97dc28a3..55667d57b1dcdd 100644 --- a/Lib/test/test_ipaddress.py +++ b/Lib/test/test_ipaddress.py @@ -2499,6 +2499,9 @@ def testReservedIpv6(self): self.assertFalse(ipaddress.ip_address('2002::').is_global) # gh-124217: conform with RFC 9637 self.assertFalse(ipaddress.ip_address('3fff::').is_global) + # gh-151749: conform with RFC 9602 and RFC 9780 + self.assertFalse(ipaddress.ip_address('5f00::').is_global) + self.assertFalse(ipaddress.ip_address('100:0:0:1::').is_global) # some generic IETF reserved addresses self.assertEqual(True, ipaddress.ip_address('100::').is_reserved) diff --git a/Misc/NEWS.d/next/Library/2026-06-20-01-00-43.gh-issue-151749.5vLBmS.rst b/Misc/NEWS.d/next/Library/2026-06-20-01-00-43.gh-issue-151749.5vLBmS.rst new file mode 100644 index 00000000000000..57dd6b5b2952d5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-06-20-01-00-43.gh-issue-151749.5vLBmS.rst @@ -0,0 +1,4 @@ +Fixed :attr:`ipaddress.IPv6Address.is_global` and +:attr:`ipaddress.IPv6Address.is_private` for the ``5f00::/16`` (:rfc:`9602`) +and ``100:0:0:1::/64`` (:rfc:`9780`) special-purpose ranges, which are not +globally reachable per the IANA registry.