python / python/mypy

subtle cache corruption when using dataclass transform leading to `Cannot determine type of "<my-dataclass-transform>" [has-type]` and a big complicated codebase (Pomodouroboros)

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

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

bug
主要言語
Python
スター
20.6k
フォーク
3.3k
平均マージ
1日 18時間
マージ済み PR(30日)
54

説明

Bug Report

This commit https://github.com/glyph/Pomodouroboros/commit/0d72cbb5079c87e3727a507c7752d1b053665abb prevents a mypy error, while making no semantic changes.

To Reproduce

Unfortunately I cannot construct a minimal reproducer.

  1. Check out that commit, replace the call to observify(SessionManager) with @observable() above the declaration of SessionManager.
  2. mypy src/pomodouroboros/model/sessions.py -> no error
  3. mypy src/ ->
    src/pomodouroboros/model/sessions.py:150: error: Cannot determine type of "observable"  [has-type]
    Found 1 error in 1 file (checked 58 source files)
    
  4. notice the error.

Expected Behavior

I would expect no error here, or at the very least, the same error with or without running mypy on the rest of the codebase.

Actual Behavior

See above.

Your Environment

  • Mypy version used: mypy 1.19.1 (compiled: yes)
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): see project
  • Python version used: 3.13.12

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

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

はじめの一歩

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

調査の方向性

Pomodouroboros のコミットと src/pomodouroboros/model/sessions.py から始め、説明されているとおりに mypy src/pomodouroboros/model/sessions.py と mypy src/ を実行します。報告されている mypy と Python のバージョンを使用して、@observable() の変更がある場合とない場合の結果を比較します。キャッシュ関連のエラーを再現でき、両方の呼び出しスコープで一貫して解消されれば完了です。

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

評価

技術スタック
python
領域
compilers
issue の種類
バグ
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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