ctypes nested array constructor doesn't work with sequences
オープン
まだ誰も着手していません。
bug
priority-1-normal
topic-plugins
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 54
説明
Using Python 3.7 and mypy 0.660 on the following code:
import ctypes
Quaternion = ctypes.c_int * 4
Pair = Quaternion * 2
quat = Quaternion(1, 2, 3, 4)
p = Pair((1, 2, 3, 4), (2, 3, 4, 5))
returns
$ mypy ctypes_nested.py
ctypes_nested.py:7: error: Array constructor argument 1 of type "Tuple[builtins.int, builtins.int, builtins.int, builtins.int]" is not convertible to the array element type "ctypes.Array[ctypes.c_int]"
ctypes_nested.py:7: error: Array constructor argument 2 of type "Tuple[builtins.int, builtins.int, builtins.int, builtins.int]" is not convertible to the array element type "ctypes.Array[ctypes.c_int]"
even though at runtime this constructor works just fine. Of course, changing the constructor to Pair(Quaternion(1, 2, 3, 4), Quaternion(2, 3, 4, 5)) works just fine.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
報告にある Python と ctypes のスニペットで問題を再現し、その後、mypy が ctypes 配列コンストラクターの引数とネストされた配列要素をどのように処理しているかを追跡してください。Pair((1, 2, 3, 4), (2, 3, 4, 5)) がエラーなしで型チェックを通過し、既存の Quaternion および明示的なネストされた配列形式が引き続き有効であれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100