`IPv6Network.next_network()` raises the wrong error when addresses run out
未关闭
还没有人认领这个 Issue。
stdlib
type-bug
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- PR 合并指标
- PR 指标待抓取
描述
Bug description:
_BaseNetwork.next_network() guards address-space exhaustion with except OverflowError, which only the IPv4 path raises, so on IPv6 the internal ValueError from _string_from_ip_int() escapes instead.
from ipaddress import IPv4Network, IPv6Network
for net in (IPv4Network('255.255.255.0/24'),
IPv6Network('ffff:ffff:ffff:ffff:ffff:ffff:ffff:0/112')):
try:
net.next_network()
except ValueError as e:
print(f"{net}: {e}")
Output:
255.255.255.0/24: out of address space, cannot make another /24 network
ffff:ffff:ffff:ffff:ffff:ffff:ffff:0/112: IPv6 address is too large
Expected: out of address space, cannot make another /112 network, the message Doc/library/ipaddress.rst gives for next_network().
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-156681
- gh-157280
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
检查 _BaseNetwork.next_network() 以及 Doc/library/ipaddress.rst 中对 next_network() 的措辞,然后复现 issue 中的 IPv4 和 IPv6 示例。完成标准是:对于 /112 网络,IPv6 地址空间耗尽时报告文档中所述的 “out of address space” 消息,而不是 “IPv6 address is too large”。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- networking
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 25/100