Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`var-annotated` errors for iteration should point to the line where the variable is defined

Aperta
#22,265 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #22266 di @freddyuniverse — chiusa senza merge

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Start by tracing how mypy reports var-annotated errors for the comprehension example in the issue, comparing native and non-native parser behavior. The payload names no source files or tests, so locate the relevant error reporting and parser tests first. Done means the error points to the line where the iteration variable is defined in both parser modes.

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

Descrizione

bug topic-error-reporting topic-parser

Bug Report

See title

To Reproduce

from typing import Never
x: Never
sum(  # non-native parser errors here
    y  # native parser errors here
    for y in x  # expected error here
)

Expected Behavior

Expected an error at # expected error here.

Actual Behavior

Got an error at either # non-native parser errors here or # native parser errors here based on the parser.

Your Environment

Reproduced in mypy-play.

  • Mypy version used: 2.4.0
  • Mypy command-line flags: N/A
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: 3.12
Lingua principale
Python
Stelle
20.7k
Fork
3.3k
Merge medio
1g 18h
PR unite (30g)
124

Preparare l'ambiente

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.

Altre issue di python/mypy

Tutte le issue di python/mypy

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.