Issue #12175: FileIO.readall() now raises a ValueError instead of an IOError if
the file is closed.
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 473919b..0fce1a3 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -536,6 +536,8 @@
     Py_ssize_t total = 0;
     int n;
 
+    if (self->fd < 0)
+        return err_closed();
     if (!_PyVerify_fd(self->fd))
         return PyErr_SetFromErrno(PyExc_IOError);