gh-151049: Add 2001:1::3/128 (RFC 9665) to ipaddress IPv6 global exceptions#151050
Open
tonghuaroot wants to merge 1 commit into
Open
gh-151049: Add 2001:1::3/128 (RFC 9665) to ipaddress IPv6 global exceptions#151050tonghuaroot wants to merge 1 commit into
tonghuaroot wants to merge 1 commit into
Conversation
…l exceptions
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.
vstinner
approved these changes
Jun 8, 2026
vstinner
left a comment
Member
There was a problem hiding this comment.
LGTM.
ipaddress _private_networks table refers to https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml which contains 2001:1::3/128: allocated in 2024-04 and refer to RFC 9665.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IANA's IPv6 Special-Purpose Address Registry (2024-04) lists
2001:1::3/128("DNS-SD Service Registration Protocol Anycast", RFC 9665) with
Globally Reachable = True, like its neighbours
2001:1::1/128(PCP, RFC 7723)and
2001:1::2/128(TURN, RFC 8155)._IPv6Constants._private_networks_exceptionscarved out::1and::2(added in GH-113179 for #113171) but never got
::3, soipaddress.ip_address('2001:1::3').is_globalwrongly returnsFalse.This PR adds
IPv6Network('2001:1::3/128')to the exceptions list, with anRFC 9665 reference comment, and extends
testReservedIpv6to assert2001:1::3is global / not private and that the adjacent unregistered2001:1::4stays non-global (so the carve-out is exact). Adds a Misc/NEWS entry.I cross-checked the whole IANA IPv6 registry against the exceptions list: every
other Globally-Reachable entry that sits inside a non-global parent block --
2001:1::1,2001:1::2,2001:3::/32,2001:4:112::/48,2001:20::/28,2001:30::/28, all under2001::/23-- is already present, so2001:1::3isthe only one missing. The two Globally-Reachable blocks that are not inside a
private parent (
64:ff9b::/96,2620:4f:8000::/48) need no exception. Theexceptions list (and the
::1/::2siblings) landed in GH-113179 and firstshipped in 3.13, so this applies to 3.13+.
Before:
>>> ipaddress.ip_address('2001:1::3').is_global FalseAfter:
AI Usage Statement
This contribution was made by the human contributor, who identified the issue
(the IANA 2024-04
2001:1::3/128/ RFC 9665 registration missing from CPython'sIPv6 exceptions table), reproduced it, designed the one-line fix to mirror the
existing
::1/::2entries, wrote the test and the NEWS entry, and reviewedand verified everything. An AI assistant helped with locating the relevant code,
cross-checking the IANA registry, and drafting text. Per the CPython policy that
disclosing AI assistance is appreciated, this is disclosed here.