1.6.1 > 1.7.0 and 1.7.1 regression in for "broken" ``dataclasses``
まだ誰も着手していません。
評価
調査の方向性
まず、issue またはそこからリンクされている mypy-playground の設定にある dataclass の例を再現し、影響を受けるバージョン間で報告される診断を比較します。誤った "B not callable" メッセージを生成している dataclass の処理を追跡します。完了条件は、例が期待どおり不足している attr_two 引数のみを報告することです。
索引モデルが issue の本文から書いたものです。
説明
Bug Report
When type checking the following code the output changes depending on whether you use 1.6.0 or 1.7.1.
To Reproduce
from dataclasses import dataclass
@dataclass(frozen=True)
class A:
attr_one: int
attr_two: int | None
@dataclass(frozen=True)
class B(A):
attr_two = None
instance = B(attr_one=1)
print(instance.attr_two)
Playground: https://mypy-play.net/?mypy=1.7.0&python=3.11&gist=f74740e7a7ef6bf0c9f88175a988aed5
The code is likely not doing what the author expects it to do, but the new message is wrong as attr_two can be referenced and is certainly not an instance of B.
Expected Behavior
main.py:15: error: Missing positional argument "attr_two" in call to "B" [call-arg]
Found 1 error in 1 file (checked 1 source file)
Actual Behavior
main.py:15: error: Missing positional argument "attr_two" in call to "B" [call-arg]
main.py:16: error: "B" not callable [operator]
Found 2 errors in 1 file (checked 1 source file)
Your Environment
master branch on Playground.
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 54
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python/mypy のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
bug topic-configuration topic-error-reporting
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
似ている issue
-
link-check link-check:sphinx-theme
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
OpenHands/extensions#626 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
CSCfi/sd-search-api#39 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100