Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

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

Aberta
#22,265 3 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

  • #22266 de @freddyuniverse — fechado sem integrar

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
58/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
python
Domínio
backend

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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
Linguagem predominante
Python
Estrelas
20.7k
Forks
3.3k
Merge médio
1d 18h
PRs com merge (30d)
123

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de python/mypy

Todas as issues de python/mypy

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.