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