[Python-checkins] cpython (2.7): #15840: make docs consistent by saying operations on closed files raise

andrew.kuchling python-checkins at python.org
Tue Apr 15 22:16:03 CEST 2014


http://hg.python.org/cpython/rev/0c7cf0e598e7
changeset:   90332:0c7cf0e598e7
branch:      2.7
parent:      90323:ff5648697ac7
user:        Andrew Kuchling <amk at amk.ca>
date:        Tue Apr 15 16:07:52 2014 -0400
summary:
  #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
implementation 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.

files:
  Modules/_io/iobase.c |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -41,8 +41,8 @@
     "bytes. bytearrays are accepted too, and in some cases (such as\n"
     "readinto) needed. Text I/O classes work with str data.\n"
     "\n"
-    "Note that calling any method (even inquiries) on a closed stream is\n"
-    "undefined. Implementations may raise IOError in this case.\n"
+    "Note that calling any method (except additional calls to close(),\n"
+    "which are ignored) on a closed stream should raise a ValueError.\n"
     "\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"

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list