From 9c44ccb8b6c62cdefbf4c66910b99be28d1deee0 Mon Sep 17 00:00:00 2001 From: y5c4l3 Date: Thu, 19 Sep 2024 20:16:37 +0800 Subject: [PATCH] Add RFC 9637 reserved IPv6 block `3fff::/20` Signed-off-by: y5c4l3 --- Lib/ipaddress.py | 1 + Lib/test/test_ipaddress.py | 2 ++ .../next/Library/2024-09-19-20-15-00.gh-issue-124217.j0KlQB.rst | 1 + 3 files changed, 4 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2024-09-19-20-15-00.gh-issue-124217.j0KlQB.rst diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py index cb41c522883d740..48675c2db151865 100644 --- a/Lib/ipaddress.py +++ b/Lib/ipaddress.py @@ -2377,6 +2377,7 @@ class _IPv6Constants: IPv6Network('2002::/16'), IPv6Network('fc00::/7'), IPv6Network('fe80::/10'), + IPv6Network('3fff::/20'), ] _private_networks_exceptions = [ diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py index aad779dd9b25e7d..6a9cfca97c1f59e 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) + # issue #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 000000000000000..30032a212323f09 --- /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