summaryrefslogtreecommitdiffstats
path: root/Modules/_io/iobase.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-09-05 23:01:12 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-09-05 23:01:12 (GMT)
commit0d739d70471cafdea04d9624cbfb7895b7d1b566 (patch)
treec8a04ae9f5b648613d724b4497c1fac3986f48fd /Modules/_io/iobase.c
parentbad092556e12e8b2cf5976718cda902bef66b3f4 (diff)
downloadcpython-0d739d70471cafdea04d9624cbfb7895b7d1b566.zip
cpython-0d739d70471cafdea04d9624cbfb7895b7d1b566.tar.gz
cpython-0d739d70471cafdea04d9624cbfb7895b7d1b566.tar.bz2
Issue #9293: I/O streams now raise `io.UnsupportedOperation` when an
unsupported operation is attempted (for example, writing to a file open only for reading).
Diffstat (limited to 'Modules/_io/iobase.c')
-rw-r--r--Modules/_io/iobase.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c
index 2d664ab..6521ae2 100644
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -317,7 +317,7 @@ _PyIOBase_check_seekable(PyObject *self, PyObject *args)
return NULL;
if (res != Py_True) {
Py_CLEAR(res);
- PyErr_SetString(PyExc_IOError, "File or stream is not seekable.");
+ iobase_unsupported("File or stream is not seekable.");
return NULL;
}
if (args == Py_True) {
@@ -346,7 +346,7 @@ _PyIOBase_check_readable(PyObject *self, PyObject *args)
return NULL;
if (res != Py_True) {
Py_CLEAR(res);
- PyErr_SetString(PyExc_IOError, "File or stream is not readable.");
+ iobase_unsupported("File or stream is not readable.");
return NULL;
}
if (args == Py_True) {
@@ -375,7 +375,7 @@ _PyIOBase_check_writable(PyObject *self, PyObject *args)
return NULL;
if (res != Py_True) {
Py_CLEAR(res);
- PyErr_SetString(PyExc_IOError, "File or stream is not writable.");
+ iobase_unsupported("File or stream is not writable.");
return NULL;
}
if (args == Py_True) {