python / python/cpython

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

Aperta
#138,275 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

interpreter-core topic-parser type-bug
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Nell’issue non sono indicati né un file sorgente né un test. Inizia individuando il punto di ingresso del parser o del compilatore CPython che emette i due assignment SyntaxErrors, quindi esamina la PR collegata gh-138283; il lavoro è completato quando i messaggi usano la formulazione documentata “starred target” e il comportamento pertinente è coperto dai test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
compilers
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.