Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
After gh-88178, .exploded works for a scoped IPv6Address, but a scoped IPv6Network still fails:
>>> import ipaddress
>>> n = ipaddress.IPv6Network('fe80::%eth0/64')
>>> str(n)
'fe80::%eth0/64'
>>> n.exploded
ipaddress.AddressValueError: Only hex digits permitted in '%eth0' in 'fe80::%eth0'I'd expect 'fe80:0000:0000:0000:0000:0000:0000:0000%eth0/64'.
The network branch of _BaseV6._explode_shorthand_ip_string still re-parses str(self.network_address),
which includes the %scope. Building the hex from int(self.network_address) and appending the scope, like the
address branch, fixes it. I'm happy to send a PR with a test.
CPython versions tested on:
3.13, 3.14, CPython main branch
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity