diff options
author | Martin Panter <vadmium+py@gmail.com> | 2016-03-31 07:21:56 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2016-03-31 07:21:56 (GMT) |
commit | 754aab28ed5f94338641db8899f89f59895c2137 (patch) | |
tree | 79c911c8dd0bc6f25f0d454e3c26608579171fb8 /Modules/_io/iobase.c | |
parent | 8dc2ec1513e90a8d23394f1c4ec3a07c4e057610 (diff) | |
download | cpython-754aab28ed5f94338641db8899f89f59895c2137.zip cpython-754aab28ed5f94338641db8899f89f59895c2137.tar.gz cpython-754aab28ed5f94338641db8899f89f59895c2137.tar.bz2 |
Issue #22854: Clarify documentation about UnsupportedOperation and add tests
Also change BufferedReader.writable() and BufferedWriter.readable() to always
return False.
Diffstat (limited to 'Modules/_io/iobase.c')
-rw-r--r-- | Modules/_io/iobase.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c index 025007e..090891d 100644 --- a/Modules/_io/iobase.c +++ b/Modules/_io/iobase.c @@ -335,13 +335,13 @@ _io._IOBase.seekable Return whether object supports random access. -If False, seek(), tell() and truncate() will raise UnsupportedOperation. +If False, seek(), tell() and truncate() will raise OSError. This method may need to do a test seek(). [clinic start generated code]*/ static PyObject * _io__IOBase_seekable_impl(PyObject *self) -/*[clinic end generated code: output=4c24c67f5f32a43d input=22676eebb81dcf1e]*/ +/*[clinic end generated code: output=4c24c67f5f32a43d input=b976622f7fdf3063]*/ { Py_RETURN_FALSE; } @@ -368,12 +368,12 @@ _io._IOBase.readable Return whether object was opened for reading. -If False, read() will raise UnsupportedOperation. +If False, read() will raise OSError. [clinic start generated code]*/ static PyObject * _io__IOBase_readable_impl(PyObject *self) -/*[clinic end generated code: output=e48089250686388b input=12fc3d8f6be46434]*/ +/*[clinic end generated code: output=e48089250686388b input=285b3b866a0ec35f]*/ { Py_RETURN_FALSE; } @@ -401,12 +401,12 @@ _io._IOBase.writable Return whether object was opened for writing. -If False, write() will raise UnsupportedOperation. +If False, write() will raise OSError. [clinic start generated code]*/ static PyObject * _io__IOBase_writable_impl(PyObject *self) -/*[clinic end generated code: output=406001d0985be14f input=c17a0bb6a8dfc590]*/ +/*[clinic end generated code: output=406001d0985be14f input=9dcac18a013a05b5]*/ { Py_RETURN_FALSE; } @@ -456,12 +456,12 @@ _io._IOBase.fileno Returns underlying file descriptor if one exists. -An IOError is raised if the IO object does not use a file descriptor. +OSError is raised if the IO object does not use a file descriptor. [clinic start generated code]*/ static PyObject * _io__IOBase_fileno_impl(PyObject *self) -/*[clinic end generated code: output=7cc0973f0f5f3b73 input=32773c5df4b7eede]*/ +/*[clinic end generated code: output=7cc0973f0f5f3b73 input=4e37028947dc1cc8]*/ { return iobase_unsupported("fileno"); } |