`f(kw=a, *b)` with keyword argument before star arguments isn’t evaluated left-to-right
未关闭
还没有人认领这个 Issue。
interpreter-core
type-bug
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- PR 合并指标
- PR 指标待抓取
描述
def f(a, kw):
pass
f(kw=print(1), *[print(2)])
In Python 3.4.10 and earlier, this prints 1 then 2, but in Python 3.5.0 and later, this prints 2 then 1.
This seems like a bug of some kind. Given that ast.parse() doesn’t distinguish between f(kw=a, *b) and f(*b, kw=a), perhaps the bug is that a keyword argument is allowed before star arguments at all—we already disallow f(kw=a, b), f(**a, b), and f(**a, *b).
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先在受影响的 Python 版本上复现所提供的 f(kw=print(1), *[print(2)]) 示例,然后跟踪 CPython 如何解析和求值包含关键字参数和星号参数的调用。当行为得到一致修正,或者在所选解决方案是拒绝无效参数顺序的情况下拒绝该顺序时,即视为完成;该 issue 未指定源文件或测试。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100