Show a more detailed error when __getattr__ in __init__.py has wrong signature

Aperta
#5,276 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
38/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Start with the referenced pull request #5231 and the getattr handling in package init.py. Reproduce a missing-import error caused by an incorrect getattr return type, then verify that the diagnostic explains that cause rather than reporting only a generic missing import.

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

Descrizione

feature priority-2-low topic-usability

This is a follow-up for https://github.com/python/mypy/pull/5231

With https://github.com/python/mypy/pull/5231 the import of an arbitrary module from a package contains a __getattr__ that returns either Any or types.ModuleType. It would be good to add a better error message about a missing import if the error appears because of a wrong return type of __getattr__.

Lingua principale
Python
Stelle
20.6k
Fork
3.3k
Merge medio
1g 18h
PR unite (30g)
54

Guida per i contributori

Apri la guida per i contributori

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.