diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-09-05 23:01:12 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-09-05 23:01:12 (GMT) |
commit | 0d739d70471cafdea04d9624cbfb7895b7d1b566 (patch) | |
tree | c8a04ae9f5b648613d724b4497c1fac3986f48fd /Modules/_io/fileio.c | |
parent | bad092556e12e8b2cf5976718cda902bef66b3f4 (diff) | |
download | cpython-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.c | 3 |
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; } |