File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2512,6 +2512,8 @@ def test_io_after_close(self):
25122512 self .assertRaises (ValueError , f .read )
25132513 if hasattr (f , "read1" ):
25142514 self .assertRaises (ValueError , f .read1 , 1024 )
2515+ if hasattr (f , "readall" ):
2516+ self .assertRaises (ValueError , f .readall )
25152517 if hasattr (f , "readinto" ):
25162518 self .assertRaises (ValueError , f .readinto , bytearray (1024 ))
25172519 self .assertRaises (ValueError , f .readline )
Original file line number Diff line number Diff line change @@ -1062,6 +1062,9 @@ Core and Builtins
10621062Library
10631063-------
10641064
1065+ - Issue #12175: FileIO.readall() now raises a ValueError instead of an IOError
1066+ if the file is closed.
1067+
10651068- Issue #10916: mmap should not segfault when a file is mapped using 0 as length
10661069 and a non-zero offset, and an attempt to read past the end of file is made
10671070 (IndexError is raised instead). Patch by Ross Lagerwall.
Original file line number Diff line number Diff line change @@ -583,6 +583,8 @@ fileio_readall(fileio *self)
583583 Py_ssize_t total = 0 ;
584584 int n ;
585585
586+ if (self -> fd < 0 )
587+ return err_closed ();
586588 if (!_PyVerify_fd (self -> fd ))
587589 return PyErr_SetFromErrno (PyExc_IOError );
588590
You can’t perform that action at this time.
0 commit comments