[Python-checkins] cpython: Fix mentions of IOError in the io module docs

antoine.pitrou python-checkins at python.org
Wed Oct 12 19:06:38 CEST 2011


http://hg.python.org/cpython/rev/a22d94547570
changeset:   72890:a22d94547570
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Wed Oct 12 19:02:52 2011 +0200
summary:
  Fix mentions of IOError in the io module docs

files:
  Doc/library/io.rst |  22 +++++++++++++---------
  1 files changed, 13 insertions(+), 9 deletions(-)


diff --git a/Doc/library/io.rst b/Doc/library/io.rst
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -33,6 +33,10 @@
 will raise a ``TypeError``.  So will giving a :class:`bytes` object to the
 ``write()`` method of a text stream.
 
+.. versionchanged:: 3.3
+   Operations defined in this module used to raise :exc:`IOError`, which is
+   now an alias of :exc:`OSError`.
+
 
 Text I/O
 ^^^^^^^^
@@ -115,7 +119,7 @@
 
 .. exception:: UnsupportedOperation
 
-   An exception inheriting :exc:`IOError` and :exc:`ValueError` that is raised
+   An exception inheriting :exc:`OSError` and :exc:`ValueError` that is raised
    when an unsupported operation is called on a stream.
 
 
@@ -194,8 +198,8 @@
    Even though :class:`IOBase` does not declare :meth:`read`, :meth:`readinto`,
    or :meth:`write` because their signatures will vary, implementations and
    clients should consider those methods part of the interface.  Also,
-   implementations may raise a :exc:`IOError` when operations they do not
-   support are called.
+   implementations may raise a :exc:`ValueError` (or :exc:`UnsupportedOperation`)
+   when operations they do not support are called.
 
    The basic type used for binary data read from or written to a file is
    :class:`bytes`.  :class:`bytearray`\s are accepted too, and in some cases
@@ -203,7 +207,7 @@
    :class:`str` data.
 
    Note that calling any method (even inquiries) on a closed stream is
-   undefined.  Implementations may raise :exc:`IOError` in this case.
+   undefined.  Implementations may raise :exc:`ValueError` in this case.
 
    IOBase (and its subclasses) support the iterator protocol, meaning that an
    :class:`IOBase` object can be iterated over yielding the lines in a stream.
@@ -236,7 +240,7 @@
    .. method:: fileno()
 
       Return the underlying file descriptor (an integer) of the stream if it
-      exists.  An :exc:`IOError` is raised if the IO object does not use a file
+      exists.  An :exc:`OSError` is raised if the IO object does not use a file
       descriptor.
 
    .. method:: flush()
@@ -252,7 +256,7 @@
    .. method:: readable()
 
       Return ``True`` if the stream can be read from.  If False, :meth:`read`
-      will raise :exc:`IOError`.
+      will raise :exc:`OSError`.
 
    .. method:: readline(limit=-1)
 
@@ -290,7 +294,7 @@
    .. method:: seekable()
 
       Return ``True`` if the stream supports random access.  If ``False``,
-      :meth:`seek`, :meth:`tell` and :meth:`truncate` will raise :exc:`IOError`.
+      :meth:`seek`, :meth:`tell` and :meth:`truncate` will raise :exc:`OSError`.
 
    .. method:: tell()
 
@@ -308,7 +312,7 @@
    .. method:: writable()
 
       Return ``True`` if the stream supports writing.  If ``False``,
-      :meth:`write` and :meth:`truncate` will raise :exc:`IOError`.
+      :meth:`write` and :meth:`truncate` will raise :exc:`OSError`.
 
    .. method:: writelines(lines)
 
@@ -442,7 +446,7 @@
 
       Write the given bytes or bytearray object, *b* and return the number
       of bytes written (never less than ``len(b)``, since if the write fails
-      an :exc:`IOError` will be raised).  Depending on the actual
+      an :exc:`OSError` will be raised).  Depending on the actual
       implementation, these bytes may be readily written to the underlying
       stream, or held in a buffer for performance and latency reasons.
 

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


More information about the Python-checkins mailing list