error in argument when using chained function-call
オープン
まだ誰も着手していません。
bug
false-positive
priority-1-normal
topic-overloads
topic-type-variables
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 54
説明
Example:
dct = {"": ""}
# ok
trans = str.maketrans(dct)
"".translate(trans)
# err
"".translate(str.maketrans(dct))
- What is the actual behavior/output?
maketrans.py:8: error: Argument 1 to "maketrans" of "str" has incompatible type "Dict[str, str]"; expected "Union[Dict[int, Union[int, str, None]], Dict[str, Union[int, str, None]], Dict[Union[str, int], Union[int, str, None]]]"
- What is the behavior/output you expect?
No error.
- What are the versions of mypy and Python you are using?
I tested both mypy 0.610 and mypy 0.620+dev-0ca6bf9ce63439a1e8bcc4dec80ef12f8414cb87 with Python 3.6.5; behavior is identical.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
maketrans.py の連鎖呼び出しの例から始め、報告されている mypy のバージョンを使って Python 3.6.5 で再現します。str.maketrans の個別の呼び出しとネストされた呼び出しを比較します。ネストされた形式で互換性のない Dict[str, str] 引数のエラーが報告されなくなれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100