diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-10-12 17:02:52 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-10-12 17:02:52 (GMT) |
commit | a787b650d4dc728674b7c490d5aa8a3d10903fdc (patch) | |
tree | 2bc2dedfe29169ba324cd4ada4629d739d2e0b3d /Doc | |
parent | f55011f8b63d3b046c1ec580312bc52ca47d721b (diff) | |
download | cpython-a787b650d4dc728674b7c490d5aa8a3d10903fdc.zip cpython-a787b650d4dc728674b7c490d5aa8a3d10903fdc.tar.gz cpython-a787b650d4dc728674b7c490d5aa8a3d10903fdc.tar.bz2 |
Fix mentions of IOError in the io module docs
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/io.rst | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst index 86faa58..0bcf687 100644 --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -33,6 +33,10 @@ giving a :class:`str` object to the ``write()`` method of a binary stream 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 @@ High-level Module Interface .. 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 @@ I/O Base Classes 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 @@ I/O Base Classes :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 @@ I/O Base Classes .. 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 @@ I/O Base Classes .. 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 @@ I/O Base Classes .. 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 @@ I/O Base Classes .. 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 @@ I/O Base Classes 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. |