Index: Lib/io.py =================================================================== --- Lib/io.py (revision 67680) +++ Lib/io.py (working copy) @@ -914,6 +914,8 @@ mode. If n is negative, read until EOF or until read() would block. """ + if self.closed: + raise ValueError("I/O operation on closed file.") with self._read_lock: return self._read_unlocked(n)