https://github.com/python/cpython/commit/6757482c25d4fa308d3f3baaa57b6db1a8c720f5
commit: 6757482c25d4fa308d3f3baaa57b6db1a8c720f5
branch: main
author: tonghuaroot (童话) <[email protected]>
committer: vstinner <[email protected]>
date: 2026-09-22T22:45:00+02:00
summary:

gh-151049: Add 2001:1::3/128 (RFC 9665) to ipaddress IPv6 global exceptions 
(#151050)

IANA's IPv6 Special-Purpose Address Registry (2024-04) lists 2001:1::3/128
("DNS-SD Service Registration Protocol Anycast", RFC 9665) as globally
reachable, like 2001:1::1/128 and 2001:1::2/128. It was missing from
_IPv6Constants._private_networks_exceptions, so is_global returned False
for it. Add the exception and extend testReservedIpv6.

files:
A Misc/NEWS.d/next/Library/2026-06-07-23-30-34.gh-issue-151049.mBlToO.rst
M Lib/ipaddress.py
M Lib/test/test_ipaddress.py

diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py
index f160cc6a7ce900..8ac2a537c46dee 100644
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -2458,6 +2458,8 @@ class _IPv6Constants:
     _private_networks_exceptions = [
         IPv6Network('2001:1::1/128'),
         IPv6Network('2001:1::2/128'),
+        # RFC 9665: https://www.rfc-editor.org/rfc/rfc9665.html
+        IPv6Network('2001:1::3/128'),
         IPv6Network('2001:3::/32'),
         IPv6Network('2001:4:112::/48'),
         IPv6Network('2001:20::/28'),
diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py
index d6d0d8220449bd..600e1f19a9cdc2 100644
--- a/Lib/test/test_ipaddress.py
+++ b/Lib/test/test_ipaddress.py
@@ -2535,6 +2535,10 @@ def testReservedIpv6(self):
         self.assertFalse(ipaddress.ip_address('2001::').is_global)
         self.assertTrue(ipaddress.ip_address('2001:1::1').is_global)
         self.assertTrue(ipaddress.ip_address('2001:1::2').is_global)
+        # gh-151049: RFC 9665 anycast address (IANA 2024-04 registration)
+        self.assertTrue(ipaddress.ip_address('2001:1::3').is_global)
+        self.assertFalse(ipaddress.ip_address('2001:1::3').is_private)
+        self.assertFalse(ipaddress.ip_address('2001:1::4').is_global)
         self.assertFalse(ipaddress.ip_address('2001:2::').is_global)
         self.assertTrue(ipaddress.ip_address('2001:3::').is_global)
         self.assertFalse(ipaddress.ip_address('2001:4::').is_global)
diff --git 
a/Misc/NEWS.d/next/Library/2026-06-07-23-30-34.gh-issue-151049.mBlToO.rst 
b/Misc/NEWS.d/next/Library/2026-06-07-23-30-34.gh-issue-151049.mBlToO.rst
new file mode 100644
index 00000000000000..0fa338e62f56d1
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-06-07-23-30-34.gh-issue-151049.mBlToO.rst
@@ -0,0 +1,4 @@
+:mod:`ipaddress`: fix ``is_global`` and ``is_private`` for the
+``2001:1::3/128`` (DNS-SD Service Registration Protocol Anycast) address,
+which IANA registered as globally reachable per :rfc:`9665`. It is now
+correctly reported with ``is_global`` ``True`` and ``is_private`` ``False``.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to