`Final` nested inside `ClassVar` results in `Any`
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
Bug Report
According to the Python 3.13 ClassVar documentation, ClassVar can be nested within Final, and Final can likewise be nested within ClassVar.
Changed in version 3.13:
ClassVarcan now be nested inFinal, and vice versa.
However, Mypy seems to type-check only the case where ClassVar is nested inside Final, not the reverse.
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.13&flags=strict&gist=996a968ac738badee42e71c23bd5f539
Expected Behavior
Success: no issues found in 1 source file
Actual Behavior
main.py:7: error: Returning Any from function declared to return "int" [no-any-return]
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used: mypy 1.17.1 (compiled: yes)
- Mypy command-line flags:
--strict - Python version used: Python 3.13.3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、リンクされている mypy-play の再現コードを Python 3.13 と --strict で実行し、次に mypy が ClassVar と Final の 2 つのネスト順序をどのように処理するかを追跡します。ClassVar 内に Final をネストした場合のリグレッションテストを追加し、その例で no-any-return も含めてエラーが報告されないことを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100