Daemonized mypy ignores errors on files that previously passed (cache bug)
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 20.6k
- Fork
- 3.3k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Bug Report
dmypy is failing to notice type errors when they are introduced into a file that has already passed type checking. I'm observing this even on extremely minimal examples. It seems like once a file passes checks once it is never checked again by dmypy.
Specifically, this seems to happen when dmypy is given a package. Explicitly passing the filename still gives the expected errors.
To Reproduce
Create a package called test_package containing an empty __init__.py and a file called test.py with the contents:
a: int = 1
b: int = "foo"
Run the following commands:
$ dmypy run -- -p test_package
test_package/test.py:2: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]
Found 1 error in 1 file (checked 2 source files)
# Comment out line 2 of test.py
$ dmypy run -- -p test_package
Success: no issues found in 2 source files
# Uncomment line 2 of test.py
$ dmypy run -- -p test_package
Success: no issues found in 2 source files
Expected Behavior
The last command should raise the "Incompatible types in assignment" error.
Actual Behavior
No issues are found, despite the contents of test.py being exactly the same as the first run.
Your Environment
- Mypy version used: 1.13.0
- Mypy command-line flags: (see examples above)
- Mypy configuration options from
mypy.ini(and other config files): None - Python version used: 3.11.6
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci il problema con dmypy run -- -p test_package usando test_package/init.py e test_package/test.py, quindi esamina il controllo dei pacchetti e il comportamento della cache del daemon. Verifica che, dopo aver commentato e decommentato l'assegnazione, l'esecuzione finale segnali nuovamente l'errore di tipi incompatibili.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100