Clarify error message when unpacking objects with `*` and `**`
未关闭
还没有人认领这个 Issue。
interpreter-core
type-feature
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
When attempting to unpack a list (or any other non-mapping) as a mapping, one gets this error message:
builtins.TypeError: 'list' object is not a mapping
It's confusing, especially since sometimes the unpacking is done on a long multi-line statement, and it's not clear that the unpacking is the source of the error.
I suggest modifying to:
builtins.TypeError: Can't unpack 'list' object using ** because it's not a mapping
I'll be happy to submit a pull request if you agree with this change.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
未指定文件或测试。搜索 CPython 中现有的 "object is not a mapping" 错误,并跟踪 ** 解包入口点;然后为使用 ** 解包列表添加覆盖,并验证生成的 TypeError 按要求标识操作和对象类型。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- compilers
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100