python / python/cpython

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

Abierto
#138,275 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

interpreter-core topic-parser type-bug
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

El issue no nombra ningún archivo fuente ni ninguna prueba. Empieza por localizar el punto de entrada del parser o compilador de CPython que emite los dos assignment SyntaxErrors y, después, revisa el PR enlazado gh-138283; se considera terminado cuando los mensajes usan la redacción documentada “starred target” y el comportamiento relevante está cubierto por pruebas.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
compilers
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.