python / python/cpython

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

Open
#138,275 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

interpreter-core topic-parser type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named in the issue. Start by locating the CPython parser or compiler entry point that emits the two assignment SyntaxErrors, then review linked PR gh-138283; done means the messages use the documented “starred target” wording and the relevant behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.