mypy crashes with "Cannot find component" on subsequent runs
未关闭
还没有人认领这个 Issue。
crash
topic-daemon
- 主要语言
- Python
- 星标
- 20.6k
- 派生
- 3.3k
- PR 合并指标
- PR 指标待抓取
描述
Crash Report
Running mypy after the first run sometimes crashes.
rm -rf .mypy_cache fixes the issue, but if I then run mypy a few more times, it crashes again.
Traceback
$ mypy
Traceback (most recent call last):
File "/path/to/mypy/mypy", line 8, in <module> sys.exit(console_entry())
File "/path/to/mypy/_-main_-.py",line 15, in console_entry main(
File "mypy/main.py", line 119, in main
File "mypy/main.py"
File "mypy/build.py"
, line 203, in run_build , line 191, in build
File "mypy/build.py", line 267, in _build File "mypy/build.py", line 2937, in dispatch
File "mypy/build.py" , line 3328, in process-graph
File "mypy/build.py",
File '
"mypy/build.py"
line 3409, in process_fresh-modules , line 2107, in fix_cross_refs
File "mypy/fixup.py" , line 52, in fixup-module
File
"mypy/fixup.py" , line 128, in visit_symbol_table
File "mypy/lookup.py", line 49, in lookup_fully_qualified
AssertionError: Cannot find component 'operators' for 'sqlalchemy.sql.operators'
To Reproduce
This is at work, and it's a rather large repo, so I can't provide easy repro steps. I would be happy to provide additional information that you need.
Your Environment
- Mypy version used: v1.15.0
- Mypy command-line flags:
- Mypy configuration options from
mypy.ini(and other config files):
[mypy]
mypy_path = server/python_stubs,server
files = server/,test/
explicit_package_bases = True
enable_incomplete_feature=InlineTypedDict
strict = True
warn_return_any = False
disallow_untyped_calls = False
no_implicit_reexport = False
warn_unreachable = True
plugins = pydantic.mypy
Additionally, we added ignore_missing_imports to most of our libraries.
- Python version used:
- python 3.11.11
- Operating system and version:
- macOS ventura
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从经过 mypy/build.py、mypy/fixup.py 和 mypy/lookup.py 的 traceback 路径开始,重点关注重新使用 .mypy_cache 后对新模块的处理。如果可能,在后续运行中重现该故障,然后验证重复运行 mypy 不再引发报告中的 AssertionError。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python, sqlalchemy
- 领域
- tooling
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100