mypyc: Any subclass of BytesIO will always generate an exception when instantiated
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 54
説明
Bug Report
Any subclass of BytesIO will always generate the following exception when instantiated:
BufferError: Existing exports of data: object cannot be re-sized
To Reproduce
1. Run TestSubclassingBytesIO.py and notice it prints two instances (one of BytesIO and the other of SubBytesIO)
2. Using mypyc compile the 4 line file: SubclassingBytesIO.py
3. Then again run the tiny TestSubclassingBytesIO.py
4. The run will crash with the mentioned exception.
Expected Behavior
Running TestSubclassingBytesIO.py after compiling with mypyc should work just like running it before compiling. It should print:
<_io.BytesIO object at 0x0000026903075BC0>
<SubclassingBytesIO.SubBytesIO object at 0x00000269030A0630>
Actual Behavior
<_io.BytesIO object at 0x00000238D1D95BC0>
Traceback (most recent call last):
File "c:\Projects\mypycbug\TestSubclassingBytesIO.py", line 7, in
x = SubBytesIO()
^^^^^^^^^^^^
BufferError: Existing exports of data: object cannot be re-sized
Your Environment
- Mypy version used: 1.5.1
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini(and other config files): None - Python version used: 3.11.4
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず TestSubclassingBytesIO.zip を展開し、SubclassingBytesIO.py を mypyc でコンパイルする前後に TestSubclassingBytesIO.py を実行します。BytesIO と SubBytesIO のインスタンス化パスを比較します。コンパイル済みスクリプトが BufferError を発生させずに両方のインスタンスを出力すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100