diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-04-16 07:46:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-16 07:46:38 (GMT) |
commit | 55fe1ae9708d81b902b6fe8f6590e2a24b1bd4b0 (patch) | |
tree | c1b3aacf87240d393666321d49a5abde3e1d601f /Modules/_io/textio.c | |
parent | fdbd01151dbd5feea3e4c0316d102db3d2a2a412 (diff) | |
download | cpython-55fe1ae9708d81b902b6fe8f6590e2a24b1bd4b0.zip cpython-55fe1ae9708d81b902b6fe8f6590e2a24b1bd4b0.tar.gz cpython-55fe1ae9708d81b902b6fe8f6590e2a24b1bd4b0.tar.bz2 |
bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051)
Diffstat (limited to 'Modules/_io/textio.c')
-rw-r--r-- | Modules/_io/textio.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c index 5639ad8..2c799e3 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -924,7 +924,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer, goto error; } else { - PyErr_SetString(PyExc_IOError, + PyErr_SetString(PyExc_OSError, "could not determine default encoding"); } @@ -2205,7 +2205,7 @@ _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence) /* Skip chars_to_skip of the decoded characters. */ if (PyUnicode_GetLength(self->decoded_chars) < cookie.chars_to_skip) { - PyErr_SetString(PyExc_IOError, "can't restore logical file position"); + PyErr_SetString(PyExc_OSError, "can't restore logical file position"); goto fail; } self->decoded_chars_used = cookie.chars_to_skip; @@ -2255,7 +2255,7 @@ _io_TextIOWrapper_tell_impl(textio *self) goto fail; } if (!self->telling) { - PyErr_SetString(PyExc_IOError, + PyErr_SetString(PyExc_OSError, "telling position disabled by next() call"); goto fail; } @@ -2421,7 +2421,7 @@ _io_TextIOWrapper_tell_impl(textio *self) cookie.need_eof = 1; if (chars_decoded < chars_to_skip) { - PyErr_SetString(PyExc_IOError, + PyErr_SetString(PyExc_OSError, "can't reconstruct logical file position"); goto fail; } @@ -2693,7 +2693,7 @@ textiowrapper_iternext(textio *self) line = PyObject_CallMethodObjArgs((PyObject *)self, _PyIO_str_readline, NULL); if (line && !PyUnicode_Check(line)) { - PyErr_Format(PyExc_IOError, + PyErr_Format(PyExc_OSError, "readline() should have returned a str object, " "not '%.200s'", Py_TYPE(line)->tp_name); Py_DECREF(line); |