Skip to content

Commit 0e67dce

Browse files
committed
gh-151749: Match surrounding comment and test style
1 parent 928525f commit 0e67dce

2 files changed

Lines changed: 7 additions & 14 deletions

File tree

Lib/ipaddress.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2387,8 +2387,10 @@ class _IPv6Constants:
23872387
IPv6Network('2002::/16'),
23882388
# RFC 9637: https://www.rfc-editor.org/rfc/rfc9637.html#section-6-2.2
23892389
IPv6Network('3fff::/20'),
2390-
IPv6Network('5f00::/16'), # RFC 9602 Segment Routing (SRv6) SIDs
2391-
IPv6Network('100:0:0:1::/64'), # RFC 9780 Dummy IPv6 Prefix
2390+
# RFC 9602: https://www.rfc-editor.org/rfc/rfc9602.html
2391+
IPv6Network('5f00::/16'),
2392+
# RFC 9780: https://www.rfc-editor.org/rfc/rfc9780.html
2393+
IPv6Network('100:0:0:1::/64'),
23922394
IPv6Network('fc00::/7'),
23932395
IPv6Network('fe80::/10'),
23942396
]

Lib/test/test_ipaddress.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,18 +2499,9 @@ def testReservedIpv6(self):
24992499
self.assertFalse(ipaddress.ip_address('2002::').is_global)
25002500
# gh-124217: conform with RFC 9637
25012501
self.assertFalse(ipaddress.ip_address('3fff::').is_global)
2502-
# gh-151749: 5f00::/16 (RFC 9602) and 100:0:0:1::/64 (RFC 9780)
2503-
# are not globally reachable per the IANA registry.
2504-
for addr in ('5f00::', '5f00::1',
2505-
'5f00:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
2506-
'100:0:0:1::', '100:0:0:1:ffff:ffff:ffff:ffff'):
2507-
self.assertFalse(ipaddress.ip_address(addr).is_global)
2508-
self.assertTrue(ipaddress.ip_address(addr).is_private)
2509-
# Addresses adjacent to the new ranges are unaffected.
2510-
for addr in ('5eff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', '5f01::',
2511-
'100:0:0:2::'):
2512-
self.assertTrue(ipaddress.ip_address(addr).is_global)
2513-
self.assertFalse(ipaddress.ip_address(addr).is_private)
2502+
# gh-151749: conform with RFC 9602 and RFC 9780
2503+
self.assertFalse(ipaddress.ip_address('5f00::').is_global)
2504+
self.assertFalse(ipaddress.ip_address('100:0:0:1::').is_global)
25142505

25152506
# some generic IETF reserved addresses
25162507
self.assertEqual(True, ipaddress.ip_address('100::').is_reserved)

0 commit comments

Comments
 (0)