gh-85524: Raise "UnsupportedOperation" on FileIO.readall (#141214)

io.UnsupportedOperation is a subclass of OSError and recommended by
io.IOBase for this case; matches other read methods on io.FileIO.
This commit is contained in:
Cody Maloney 2025-11-12 01:37:48 -08:00 committed by GitHub
parent 909f76dab9
commit 6f988b08d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 8 deletions

View file

@ -125,6 +125,7 @@ def test_invalid_operations(self):
self.assertRaises(exc, fp.readline)
with self.open(os_helper.TESTFN, "wb", buffering=0) as fp:
self.assertRaises(exc, fp.read)
self.assertRaises(exc, fp.readall)
self.assertRaises(exc, fp.readline)
with self.open(os_helper.TESTFN, "rb", buffering=0) as fp:
self.assertRaises(exc, fp.write, b"blah")