Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

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

Offen
#22,280 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@bniladridas arbeitet bereits daran.

Seit 25.10.2026.

  • #1 von @bniladridas — ohne Merge geschlossen
  • #22285 von @ShahabAhmed01 — ohne Merge geschlossen
  • #22298 von @bniladridas — offen

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
63/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
python

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Python
Sterne
20.7k
Forks
3.3k
Ø Merge
1 T. 18 Std.
Gemergte PRs (30 T.)
123

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus python/mypy

Alle Issues in python/mypy

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.