Bad circular imports are not rejected

Aperta
#61 12 commenti 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
compilers

Direzione di ricerca

Start by reproducing the issue with the a.py and b.py examples given in the report, then trace how mypy handles their imports. Define the intended diagnostic and add a regression case showing that the circular import is rejected without allowing invalid generated Python to pass.

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

Descrizione

feature priority-2-low topic-runtime-semantics

If a.py contains

import b
name = 'a'
print(b.name)

and b.py contains

import a
name = 'b'
print(a.name)

then mypy compiles a.py without error, but the generated python throws an error because of the circular import.

(Found this one while refactoring mypy itself into packages)

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.