python / python/mypy

mypy crashes with "Cannot find component" on subsequent runs

オープン
#18,751 コメント 8 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず mypy/build.py、mypy/fixup.py、mypy/lookup.py を通る traceback の経路を調べ、.mypy_cache が再利用された後の新しいモジュールの処理に注目してください。可能であれば後続の実行でも失敗を再現し、その後、my​​py を繰り返し実行しても報告された AssertionError が発生しないことを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python, sqlalchemy
領域
tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。