Message374027
Here are the two test cases: the one with FileIO.readall() fails
def testReadWithWritingMode(self):
r, w = os.pipe()
w = os.fdopen(w, "w")
w.write("hello")
w.close()
with io.FileIO(r, mode="w") as f:
with self.assertRaises(_io.UnsupportedOperation):
f.read()
def testReadallWithWritingMode(self):
r, w = os.pipe()
w = os.fdopen(w, "w")
w.write("hello")
w.close()
with io.FileIO(r, mode="w") as f:
with self.assertRaises(_io.UnsupportedOperation):
f.readall()
With FileIO.read() raises "UnsupportedOperation" in "w" mode, I expect FileIO.readall() do the same. But in fact FileIO.readall() does not check for readable and does not raise "UnsupportedOperation" in "w"mode.
I'm happy to write a pull request if you want. |
|
Date |
User |
Action |
Args |
2020-07-20 21:14:00 | Ziyi Wang | set | recipients:
+ Ziyi Wang |
2020-07-20 21:14:00 | Ziyi Wang | set | messageid: <1595279640.58.0.284092405556.issue41352@roundup.psfhosted.org> |
2020-07-20 21:14:00 | Ziyi Wang | link | issue41352 messages |
2020-07-20 21:14:00 | Ziyi Wang | create | |
|