python / python/cpython

Using multiple starred targets on the left side of `=` gets the error message saying "starred expressions" instead of "starred targets"

未关闭
#138,275 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

interpreter-core topic-parser type-bug
主要语言
Python
星标
77.2k
派生
36k
PR 合并指标
PR 指标待抓取

描述

Bug report

Bug description:

The doc says starred target as shown below:

*Memo:

If the target list contains one target prefixed with an asterisk, called a “starred” target:

But using multiple starred targets on the left side of = gets the error message saying starred expressions instead of starred targets as shown below:

*v1, *v2, *v3 = [0, 1, 2, 3, 4]
# Error

SyntaxError: multiple starred expressions in assignment

So, the error message should say starred targets as shown below:

SyntaxError: multiple starred targets in assignment

And, using a single starred target on the left side of = gets the error message saying starred assignment target as shown below:

*v = [0, 1, 2, 3, 4]

SyntaxError: starred assignment target must be in a list or tuple

So, the error message should say starred target as shown below:

SyntaxError: starred target must be in a list or tuple in assignment

CPython versions tested on:

3.12

Operating systems tested on:

Windows

Linked PRs
  • gh-138283

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

issue 中没有指定源文件或测试。首先定位会发出两个 assignment SyntaxErrors 的 CPython parser 或 compiler 入口点,然后查看链接的 PR gh-138283;当消息使用文档规定的“starred target”措辞,并且相关行为已由测试覆盖时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
compilers
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。