Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[2.4 regression] modules imported inside a method of an `ignore_errors` module aren't checked anymore

Aperta
#22,280 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@bniladridas ci sta già lavorando.

Dal 25/10/2026.

  • #1 di @bniladridas — chiusa senza merge
  • #22285 di @ShahabAhmed01 — chiusa senza merge
  • #22298 di @bniladridas — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
63/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Start by reproducing the regression with the provided pkg modules and mypy.ini, comparing the reported 2.3.1 and 2.4.0 results. Trace how imports inside methods are handled when the importing module has ignore_errors = True; the issue names no mypy source file or test. Done means mypy still reports the incompatible assignment in pkg/b.py under the 2.4.0 configuration.

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

Descrizione

bug topic-parser topic-stubtest

pkg/__init__.py:

# -- nothing to see here --

pkg/a.py:

class A:
    def f(self) -> None:
        import pkg.b

pkg/b.py:

x: int = "moo"

repro.py:

import pkg.a

mypy.ini:

[mypy]
[mypy-pkg.a]
ignore_errors = True

2.3.1

$ uvx --with="mypy==2.3.1" mypy repro.py
pkg/b.py:1: error: Incompatible types in assignment (expression has type "str", variable has type "int")  [assignment]
Found 1 error in 1 file (checked 1 source file)

2.4.0

$ uvx --with="mypy==2.4.0" mypy repro.py
Success: no issues found in 1 source file

Numba runs stubtest with ignore_errors = True, so after upgrading mypy to 2.4.0 (in numba/numba#10887) this bug caused new failed to find stubs errors for modules that are only imported from within some method. The workaround is to set native_parser = False in the mypy.ini for now.

Lingua principale
Python
Stelle
20.7k
Fork
3.3k
Merge medio
1g 16h
PR unite (30g)
120

Preparare l'ambiente

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.