File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2467,6 +2467,8 @@ def test_io_after_close(self):
24672467 self .assertRaises (ValueError , f .read )
24682468 if hasattr (f , "read1" ):
24692469 self .assertRaises (ValueError , f .read1 , 1024 )
2470+ if hasattr (f , "readall" ):
2471+ self .assertRaises (ValueError , f .readall )
24702472 if hasattr (f , "readinto" ):
24712473 self .assertRaises (ValueError , f .readinto , bytearray (1024 ))
24722474 self .assertRaises (ValueError , f .readline )
Original file line number Diff line number Diff line change @@ -75,6 +75,9 @@ Core and Builtins
7575Library
7676-------
7777
78+ - Issue #12175: FileIO.readall() now raises a ValueError instead of an IOError
79+ if the file is closed.
80+
7881- Issue #12100: Don't reset incremental encoders of CJK codecs at each call to
7982 their encode() method anymore, but continue to call the reset() method if the
8083 final argument is True.
Original file line number Diff line number Diff line change @@ -536,6 +536,8 @@ fileio_readall(fileio *self)
536536 Py_ssize_t total = 0 ;
537537 int n ;
538538
539+ if (self -> fd < 0 )
540+ return err_closed ();
539541 if (!_PyVerify_fd (self -> fd ))
540542 return PyErr_SetFromErrno (PyExc_IOError );
541543
You can’t perform that action at this time.
0 commit comments