Skip to content

gh-161384: Fix IPv6Network.exploded for networks with a scope ID - #161398

Closed
0z5a wants to merge 1 commit into
python:mainfrom
0z5a:fix-ipv6network-exploded-scope
Closed

0z5a wants to merge 1 commit into
python:mainfrom
0z5a:fix-ipv6network-exploded-scope

Conversation

@0z5a

@0z5a 0z5a commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Fixes gh-161384.

IPv6Network('fe80::%eth0/64').exploded raised AddressValueError because _explode_shorthand_ip_string() built the network text from str(self.network_address), which includes the %scope suffix, and then passed it to _ip_int_from_string().

Format the network address from its integer value instead, and append the scope ID before the prefix. For networks the scope lives on network_address, so it is read from there; addresses and interfaces keep using self._scope_id. Non-scoped networks and IPv4 are unchanged.

Tests: IpaddrUnitTest.testExplodeShortHandIpStr now covers the network case. Built current main (5aa2f705) on aarch64 (GH200, GCC 13.3): the test passes with the patch and fails on unpatched main with AddressValueError.

@python-cla-bot

python-cla-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@picnixz

picnixz commented Nov 5, 2026

Copy link
Copy Markdown
Member

The OP said they would be happy to work on a PR.

@picnixz picnixz added the AI-guidelines-not-met The contribution does not meet our guidelines for using AI tools and is closed automatically. label Nov 5, 2026
@0z5a
0z5a deleted the fix-ipv6network-exploded-scope branch November 5, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-guidelines-not-met The contribution does not meet our guidelines for using AI tools and is closed automatically. awaiting review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ipaddress: IPv6Network.exploded fails for networks with a scope ID

2 participants