false positive no-any-return from a typed function nested in an untyped function
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
If an inner typed function which returns something other than None is nested within an untyped function then an error is generated about returning Any from the inner function.
To Reproduce
Expected Behavior
bug.py:7: note: Revealed type is "pathlib.Path"
bug.py:15: note: Revealed type is "pathlib.Path"
bug.py:26: note: Revealed type is "pathlib.Path"
Success: no issues found in 1 source file
Actual Behavior
main.py:7: note: Revealed type is "pathlib.Path"
main.py:15: note: Revealed type is "pathlib.Path"
main.py:26: note: Revealed type is "Any"
main.py:27: error: Returning Any from function declared to return "str" [no-any-return]
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used:1.19.1
- Mypy command-line flags: --warn-return-any
- Mypy configuration options from
mypy.ini(and other config files): none - Python version used: 3.13
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
Inizia con la riproduzione collegata di mypy-play usando Python 3.13 e --warn-return-any, quindi traccia il modo in cui mypy gestisce una funzione interna tipizzata annidata in una funzione non tipizzata. Il lavoro è completato quando la funzione interna conserva il tipo di ritorno pathlib.Path inferito e la riproduzione non segnala alcun errore no-any-return erroneo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100