Inconsistant behavior of .readable() and .writable() on io.IOBase
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 558
説明
Bug report
The methods .readble() and .writable() on io.IOBase should return a boolean representing if the file can be read from/written to. However, calling .readable() on a closed IO file object causes a ValueError, whereas calling .writable() on a closed file returns False if the file was opened with just read permissions, but raises ValueError if it was opened with read and write permissions.
Make a folder with a text file in, then run:
f = open("hello.txt")
print(f.writable())
print(f.readable())
f.close()
print(f.writable())
print(f.readable())
This will output:
False
True
False
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: I/O operation on closed file
Then doing a similar thing, but with w+ permissions
f = open("hello.txt", "w+")
print(f.writable())
print(f.readable())
f.close()
print(f.writable())
print(f.readable())
Will output
True
True
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: I/O operation on closed file
Your environment
- CPython versions tested on: 3.10.4
- Operating system and architecture: Windows 64bit
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、issue にあるクローズされたファイルの 2 つの例を再現し、次に io.IOBase.readable() と writable() のエントリポイントおよび関連するテストを調べます。完了の条件は、2 つのメソッドがクローズされたファイルに対して一貫性のある文書化された動作をし、オープンされたファイルに対する期待される結果を維持することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- operating-systems
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100