]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-124217, ipaddress: Add RFC 9637 reserved IPv6 block `3fff::/20` (GH-124240...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 20 Sep 2024 12:20:27 +0000 (14:20 +0200)
committerGitHub <noreply@github.com>
Fri, 20 Sep 2024 12:20:27 +0000 (14:20 +0200)
gh-124217, ipaddress: Add RFC 9637 reserved IPv6 block `3fff::/20` (GH-124240)
(cherry picked from commit db6eb3640a7d98db6fea17cf9da4cb14504e5571)

Signed-off-by: y5c4l3 <y5c4l3@proton.me>
Co-authored-by: Y5 <124019959+y5c4l3@users.noreply.github.com>
Lib/ipaddress.py
Lib/test/test_ipaddress.py
Misc/NEWS.d/next/Library/2024-09-19-20-15-00.gh-issue-124217.j0KlQB.rst [new file with mode: 0644]

index 8ca45d68a1dfbfb39539f43e02cfdcf2620fbbc9..76031dede8a54b5955e6283ea4f87194f84c3737 100644 (file)
@@ -2347,6 +2347,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'),
         ]
index e674158ac0a3a5f9a0a99c7643f9b4adb107b0d0..3c8a928b91cd7d4a24493a8e7242529a3ab1e632 100644 (file)
@@ -2408,6 +2408,8 @@ class IpaddrUnitTest(unittest.TestCase):
         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 (file)
index 0000000..46f9866
--- /dev/null
@@ -0,0 +1 @@
+Add RFC 9637 reserved IPv6 block ``3fff::/20`` in :mod:`ipaddress` module.