Callable with single argument accepts args expanding
オープン
まだ誰も着手していません。
bug
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
Bug Report
(A clear and concise description of what the bug is.)
To Reproduce
from typing import Callable, TypeVar
T_ = TypeVar("T_")
P_ = TypeVar("P_")
def convert_to_hook(f: Callable[[P_], T_]) -> Callable[[list[P_]], T_]:
def hook_f(args: list[P_]) -> T_:
return f(*args)
return hook_f
https://mypy-play.net/?mypy=latest&python=3.10&gist=e45c80cbb1e609c235b4da1813501cd5
Expected Behavior
The type check should fail and point to f(*args), because f is accepting only a single argument of type P_.
Actual Behavior
Success: no issues found in 1 source file
Your Environment
- Mypy version used:
- Mypy command-line flags:
- Mypy configuration options from
mypy.ini(and other config files): - Python version used:
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
報告された Python の再現コードから始め、リンクされた mypy-play の例またはローカルの mypy checkout で実行します。f(*args) 周辺の callable と引数展開の型チェックを追跡します。f は P_ 型の引数を 1 つしか受け取らないため、mypy が f(*args) でエラーを報告すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100