super(type, cls).__new__ saying not an instance when it is
オープン
まだ誰も着手していません。
bug
priority-1-normal
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
When upgrading to the latest mypy I started getting a weird new error. Here's a simplified example:
class X:
def __new__(cls) -> "X":
return super(type, cls).__new__(cls) # error: Argument 2 for "super" not an instance of argument 1
However:
>>> isinstance(X, type)
True
My settings: mypy 0.730
[mypy]
python_version=3.6
incremental=True
ignore_missing_imports=True
follow_imports=normal
warn_redundant_casts=True
warn_unused_ignores=True
strict_optional=True
no_implicit_optional=True
disallow_untyped_defs=True
disallow_any_generics=True
(Note: I'm using super to skip an inherited __new__ when I create the object.)
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、mypy 0.730 で最小限の X.new の例を実行し、チェッカーが super(type, cls) と new の呼び出しをどのように処理するかを調べます。レポートではソースファイルやテストは指定されていません。完了の条件は、有効な例で instance-type error が発生しなくなり、このリグレッションをカバーするテストがあることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100