[2.4 regression] modules imported inside a method of an `ignore_errors` module aren't checked anymore
維護者通常 1 天內回覆
@bniladridas 已經在處理了。
開始於 2026年10月25日。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 63/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- python
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- Python
- 星號
- 20.7k
- 分支
- 3.3k
- 平均合併
- 1 天 18 小時
- 30 天內合併 PR
- 123
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
python/mypy 的其他 Issue
-
Regression in 2.4.0: empty constraint tuple in PEP 695 type parameter (`class C[T: ()]`) is no longer reported可能重新可做 @CheerathAniketh 於 15 天前認領,目前沒有進行中的 PR。 未關閉topic-parser topic-pep-695
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
matches_gitignore: directory-only patterns in nested .gitignore not excluded under --exclude-gitignore可能已有人在做 @pavithraramesh5500-ship-cse 於 6 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
`stubgen --inspect-mode` crashes with `AttributeError on PEP 604 union syntax (X | Y)` *(mypy 2.1.0)*可能已有人在做 @ayushdoesdev 於 82 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
Inconsistent description of `strict_optional`可能已有人在做 @Joosboy 於 99 天前認領。 未關閉documentation
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
Cannot set `output` in `mypy.ini`可能重新可做 關聯的 PR 已關閉且未合併。 未關閉bug topic-configuration topic-error-reporting
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
相似的 Issue
-
request-theme
難度 1/5 1 小時以內 新手友好度 66/100
LizardByte/ThemerrDB#9575 ·
維護者通常 1 天內回覆
-
author-page correction
難度 2/5 1-3 小時 新手友好度 62/100
acl-org/acl-anthology#10599 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
zilliztech/memsearch#818 ·
維護者通常 1 天內回覆
-
[FAQ] Commit ID for Projects可能已有人在做 @github-actions 今天認領。 未關閉faq-proposal
難度 1/5 1 小時以內 新手友好度 84/100
DataTalksClub/faq#503 · 1 則留言 ·
維護者通常 2 天內回覆
-
README.zh-CN/ja/es still hard-code 501 test counts after README.md went count-free可能已有人在做 @Aaqibhafeezkhan 今天認領。 未關閉beginner documentation good first issue
難度 2/5 1-3 小時 新手友好度 75/100
BistaDinesh03/critique#164 · 1 則留言 ·
維護者通常 1 天內回覆