https://github.com/python/cpython/commit/db6eb3640a7d98db6fea17cf9da4cb14504e5571
commit: db6eb3640a7d98db6fea17cf9da4cb14504e5571
branch: main
author: Y5 <[email protected]>
committer: vstinner <[email protected]>
date: 2024-09-20T11:01:28Z
summary:

gh-124217, ipaddress: Add RFC 9637 reserved IPv6 block `3fff::/20` (#124240)

Signed-off-by: y5c4l3 <[email protected]>

files:
A Misc/NEWS.d/next/Library/2024-09-19-20-15-00.gh-issue-124217.j0KlQB.rst
M Lib/ipaddress.py
M Lib/test/test_ipaddress.py

diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py
index cb41c522883d74..703fa289dda1fb 100644
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -2375,6 +2375,8 @@ class _IPv6Constants:
         IPv6Network('2001:db8::/32'),
         # IANA says N/A, let's consider it not globally reachable to be safe
         IPv6Network('2002::/16'),
+        # RFC 9637: https://www.rfc-editor.org/rfc/rfc9637.html#section-6-2.2
+        IPv6Network('3fff::/20'),
         IPv6Network('fc00::/7'),
         IPv6Network('fe80::/10'),
         ]
diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py
index aad779dd9b25e7..b1ac2b94f41b38 100644
--- a/Lib/test/test_ipaddress.py
+++ b/Lib/test/test_ipaddress.py
@@ -2433,6 +2433,8 @@ def testReservedIpv6(self):
         self.assertTrue(ipaddress.ip_address('2001:30::').is_global)
         self.assertFalse(ipaddress.ip_address('2001:40::').is_global)
         self.assertFalse(ipaddress.ip_address('2002::').is_global)
+        # gh-124217: conform with RFC 9637
+        self.assertFalse(ipaddress.ip_address('3fff::').is_global)
 
         # some generic IETF reserved addresses
         self.assertEqual(True, ipaddress.ip_address('100::').is_reserved)
diff --git 
a/Misc/NEWS.d/next/Library/2024-09-19-20-15-00.gh-issue-124217.j0KlQB.rst 
b/Misc/NEWS.d/next/Library/2024-09-19-20-15-00.gh-issue-124217.j0KlQB.rst
new file mode 100644
index 00000000000000..46f9866f8d427c
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-09-19-20-15-00.gh-issue-124217.j0KlQB.rst
@@ -0,0 +1 @@
+Add RFC 9637 reserved IPv6 block ``3fff::/20`` in :mod:`ipaddress` module.

_______________________________________________
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