#15840: make docs consistent by saying operations on closed files raise ValueError.

Patch by Caelyn McAulay.

Neither Caelyn nor I could find any cases in 2.7 or 3.4/5 where an
operation on a closed stream raised IOError; generally the C
implementations have a macro to check for the stream being closed, and
these macros all raised ValueError.  If we find any, a new bug should
be opened.
This commit is contained in:
Andrew Kuchling 2014-04-15 21:11:36 -04:00
parent fc1020d396
commit 764662020b

View file

@ -42,8 +42,8 @@ PyDoc_STRVAR(iobase_doc,
"bytes. bytearrays are accepted too, and in some cases (such as\n" "bytes. bytearrays are accepted too, and in some cases (such as\n"
"readinto) needed. Text I/O classes work with str data.\n" "readinto) needed. Text I/O classes work with str data.\n"
"\n" "\n"
"Note that calling any method (even inquiries) on a closed stream is\n" "Note that calling any method (except additional calls to close(),\n"
"undefined. Implementations may raise IOError in this case.\n" "which are ignored) on a closed stream should raise a ValueError.\n"
"\n" "\n"
"IOBase (and its subclasses) support the iterator protocol, meaning\n" "IOBase (and its subclasses) support the iterator protocol, meaning\n"
"that an IOBase object can be iterated over yielding the lines in a\n" "that an IOBase object can be iterated over yielding the lines in a\n"