`@deprecated` doesn't work with non-overloaded constructors
オープン
まだ誰も着手していません。
bug
topic-pep-702
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
Bug Report, To Reproduce, & Actual Behaviour
This is similar to #19588, but that was fixed on master for the case when __init__ is overloaded.
In the non-overloaded case, @deprecated still doesn't report anything (mypy Playground):
To Reproduce
from typing import overload
from typing_extensions import deprecated, Self
class Some:
@deprecated("reason")
def __new__(cls, x: str) -> Self: ...
Some('test') # No reports here
class Some2:
@deprecated("reason")
def __init__(self, x: str) -> None: ...
Some2('test') # No reports here
Expected Behavior
Some('test') # E: function Some.__new__ is deprecated: reason [deprecated]
Some2('test') # E: function Some.__init__ is deprecated: reason [deprecated]
Your Environment
- Mypy version used: 1.18.2, master
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、リンク先の mypy Playground で非オーバーロードの Some.new と Some2.init のケースを再現し、次に #19588 のオーバーロードされたケースとその扱いを比較します。完了条件は、両方のコンストラクター呼び出しが issue に示された期待どおりの [deprecated] 診断を出力することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100