summaryrefslogtreecommitdiffstats
path: root/Modules/_io/fileio.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/fileio.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/fileio.c')
-rw-r--r--Modules/_io/fileio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 4f450da..ff278cf 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -417,7 +417,8 @@ err_closed(void)
static PyObject *
err_mode(char *action)
{
- PyErr_Format(PyExc_ValueError, "File not open for %s", action);
+ PyErr_Format(IO_STATE->unsupported_operation,
+ "File not open for %s", action);
return NULL;
}