summaryrefslogtreecommitdiffstats
path: root/Modules/_io
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_io')
-rw-r--r--Modules/_io/_iomodule.c8
-rw-r--r--Modules/_io/_iomodule.h2
-rw-r--r--Modules/_io/bufferedio.c18
-rw-r--r--Modules/_io/clinic/_iomodule.c.h4
-rw-r--r--Modules/_io/fileio.c8
-rw-r--r--Modules/_io/iobase.c4
-rw-r--r--Modules/_io/stringio.c4
-rw-r--r--Modules/_io/textio.c10
8 files changed, 29 insertions, 29 deletions
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c
index bc2fb32..f0621f4 100644
--- a/Modules/_io/_iomodule.c
+++ b/Modules/_io/_iomodule.c
@@ -61,7 +61,7 @@ PyDoc_STRVAR(module_doc,
"At the top of the I/O hierarchy is the abstract base class IOBase. It\n"
"defines the basic interface to a stream. Note, however, that there is no\n"
"separation between reading and writing to streams; implementations are\n"
-"allowed to raise an IOError if they do not support a given operation.\n"
+"allowed to raise an OSError if they do not support a given operation.\n"
"\n"
"Extending IOBase is RawIOBase which deals simply with the reading and\n"
"writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide\n"
@@ -107,7 +107,7 @@ _io.open
closefd: bool(accept={int}) = True
opener: object = None
-Open file and return a stream. Raise IOError upon failure.
+Open file and return a stream. Raise OSError upon failure.
file is either a text or byte string giving the name (and the path
if the file isn't in the current working directory) of the file to
@@ -231,7 +231,7 @@ static PyObject *
_io_open_impl(PyObject *module, PyObject *file, const char *mode,
int buffering, const char *encoding, const char *errors,
const char *newline, int closefd, PyObject *opener)
-/*[clinic end generated code: output=aefafc4ce2b46dc0 input=7f81b2a1d3b02344]*/
+/*[clinic end generated code: output=aefafc4ce2b46dc0 input=03da2940c8a65871]*/
{
unsigned i;
@@ -656,7 +656,7 @@ PyInit__io(void)
if (PyModule_AddIntMacro(m, DEFAULT_BUFFER_SIZE) < 0)
goto fail;
- /* UnsupportedOperation inherits from ValueError and IOError */
+ /* UnsupportedOperation inherits from ValueError and OSError */
state->unsupported_operation = PyObject_CallFunction(
(PyObject *)&PyType_Type, "s(OO){}",
"UnsupportedOperation", PyExc_OSError, PyExc_ValueError);
diff --git a/Modules/_io/_iomodule.h b/Modules/_io/_iomodule.h
index c589c38..db84037 100644
--- a/Modules/_io/_iomodule.h
+++ b/Modules/_io/_iomodule.h
@@ -67,7 +67,7 @@ extern Py_ssize_t _PyIO_find_line_ending(
int translated, int universal, PyObject *readnl,
int kind, const char *start, const char *end, Py_ssize_t *consumed);
-/* Return 1 if an EnvironmentError with errno == EINTR is set (and then
+/* Return 1 if an OSError with errno == EINTR is set (and then
clears the error indicator), 0 otherwise.
Should only be called when PyErr_Occurred() is true.
*/
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index 24e052b..189b1cd 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -695,7 +695,7 @@ _buffered_raw_tell(buffered *self)
Py_DECREF(res);
if (n < 0) {
if (!PyErr_Occurred())
- PyErr_Format(PyExc_IOError,
+ PyErr_Format(PyExc_OSError,
"Raw stream returned invalid position %" PY_PRIdOFF,
(PY_OFF_T_COMPAT)n);
return -1;
@@ -728,7 +728,7 @@ _buffered_raw_seek(buffered *self, Py_off_t target, int whence)
Py_DECREF(res);
if (n < 0) {
if (!PyErr_Occurred())
- PyErr_Format(PyExc_IOError,
+ PyErr_Format(PyExc_OSError,
"Raw stream returned invalid position %" PY_PRIdOFF,
(PY_OFF_T_COMPAT)n);
return -1;
@@ -776,7 +776,7 @@ _buffered_init(buffered *self)
return 0;
}
-/* Return 1 if an EnvironmentError with errno == EINTR is set (and then
+/* Return 1 if an OSError with errno == EINTR is set (and then
clears the error indicator), 0 otherwise.
Should only be called when PyErr_Occurred() is true.
*/
@@ -785,17 +785,17 @@ _PyIO_trap_eintr(void)
{
static PyObject *eintr_int = NULL;
PyObject *typ, *val, *tb;
- PyEnvironmentErrorObject *env_err;
+ PyOSErrorObject *env_err;
if (eintr_int == NULL) {
eintr_int = PyLong_FromLong(EINTR);
assert(eintr_int != NULL);
}
- if (!PyErr_ExceptionMatches(PyExc_EnvironmentError))
+ if (!PyErr_ExceptionMatches(PyExc_OSError))
return 0;
PyErr_Fetch(&typ, &val, &tb);
PyErr_NormalizeException(&typ, &val, &tb);
- env_err = (PyEnvironmentErrorObject *) val;
+ env_err = (PyOSErrorObject *) val;
assert(env_err != NULL);
if (env_err->myerrno != NULL &&
PyObject_RichCompareBool(env_err->myerrno, eintr_int, Py_EQ) > 0) {
@@ -1374,7 +1374,7 @@ buffered_iternext(buffered *self)
line = PyObject_CallMethodObjArgs((PyObject *)self,
_PyIO_str_readline, NULL);
if (line && !PyBytes_Check(line)) {
- PyErr_Format(PyExc_IOError,
+ PyErr_Format(PyExc_OSError,
"readline() should have returned a bytes object, "
"not '%.200s'", Py_TYPE(line)->tp_name);
Py_DECREF(line);
@@ -1501,7 +1501,7 @@ _bufferedreader_raw_read(buffered *self, char *start, Py_ssize_t len)
n = PyNumber_AsSsize_t(res, PyExc_ValueError);
Py_DECREF(res);
if (n < 0 || n > len) {
- PyErr_Format(PyExc_IOError,
+ PyErr_Format(PyExc_OSError,
"raw readinto() returned invalid length %zd "
"(should have been between 0 and %zd)", n, len);
return -1;
@@ -1858,7 +1858,7 @@ _bufferedwriter_raw_write(buffered *self, char *start, Py_ssize_t len)
n = PyNumber_AsSsize_t(res, PyExc_ValueError);
Py_DECREF(res);
if (n < 0 || n > len) {
- PyErr_Format(PyExc_IOError,
+ PyErr_Format(PyExc_OSError,
"raw write() returned invalid length %zd "
"(should have been between 0 and %zd)", n, len);
return -1;
diff --git a/Modules/_io/clinic/_iomodule.c.h b/Modules/_io/clinic/_iomodule.c.h
index a1ba869..245df25 100644
--- a/Modules/_io/clinic/_iomodule.c.h
+++ b/Modules/_io/clinic/_iomodule.c.h
@@ -7,7 +7,7 @@ PyDoc_STRVAR(_io_open__doc__,
" errors=None, newline=None, closefd=True, opener=None)\n"
"--\n"
"\n"
-"Open file and return a stream. Raise IOError upon failure.\n"
+"Open file and return a stream. Raise OSError upon failure.\n"
"\n"
"file is either a text or byte string giving the name (and the path\n"
"if the file isn\'t in the current working directory) of the file to\n"
@@ -158,4 +158,4 @@ _io_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
exit:
return return_value;
}
-/*[clinic end generated code: output=79fd04d9c9d8f28f input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e6011c784fe6589b input=a9049054013a1b77]*/
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 3c0b752..922db3e 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -123,7 +123,7 @@ internal_close(fileio *self)
}
if (err < 0) {
errno = save_errno;
- PyErr_SetFromErrno(PyExc_IOError);
+ PyErr_SetFromErrno(PyExc_OSError);
return -1;
}
return 0;
@@ -456,7 +456,7 @@ _io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
directories, so we need a check. */
if (S_ISDIR(fdfstat.st_mode)) {
errno = EISDIR;
- PyErr_SetFromErrnoWithFilenameObject(PyExc_IOError, nameobj);
+ PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError, nameobj);
goto error;
}
#endif /* defined(S_ISDIR) */
@@ -910,7 +910,7 @@ portable_lseek(int fd, PyObject *posobj, int whence)
_Py_END_SUPPRESS_IPH
Py_END_ALLOW_THREADS
if (res < 0)
- return PyErr_SetFromErrno(PyExc_IOError);
+ return PyErr_SetFromErrno(PyExc_OSError);
#if defined(HAVE_LARGEFILE_SUPPORT)
return PyLong_FromLongLong(res);
@@ -1023,7 +1023,7 @@ _io_FileIO_truncate_impl(fileio *self, PyObject *posobj)
if (ret != 0) {
Py_DECREF(posobj);
- PyErr_SetFromErrno(PyExc_IOError);
+ PyErr_SetFromErrno(PyExc_OSError);
return NULL;
}
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c
index 1a687c5..b7a506b 100644
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -526,7 +526,7 @@ _io__IOBase_readline_impl(PyObject *self, Py_ssize_t limit)
goto fail;
}
if (!PyBytes_Check(readahead)) {
- PyErr_Format(PyExc_IOError,
+ PyErr_Format(PyExc_OSError,
"peek() should have returned a bytes object, "
"not '%.200s'", Py_TYPE(readahead)->tp_name);
Py_DECREF(readahead);
@@ -566,7 +566,7 @@ _io__IOBase_readline_impl(PyObject *self, Py_ssize_t limit)
goto fail;
}
if (!PyBytes_Check(b)) {
- PyErr_Format(PyExc_IOError,
+ PyErr_Format(PyExc_OSError,
"read() should have returned a bytes object, "
"not '%.200s'", Py_TYPE(b)->tp_name);
Py_DECREF(b);
diff --git a/Modules/_io/stringio.c b/Modules/_io/stringio.c
index 2ec32ac..718b1ac 100644
--- a/Modules/_io/stringio.c
+++ b/Modules/_io/stringio.c
@@ -410,7 +410,7 @@ stringio_iternext(stringio *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);
@@ -498,7 +498,7 @@ _io_StringIO_seek_impl(stringio *self, Py_ssize_t pos, int whence)
return NULL;
}
else if (whence != 0 && pos != 0) {
- PyErr_SetString(PyExc_IOError,
+ PyErr_SetString(PyExc_OSError,
"Can't do nonzero cur-relative seeks");
return NULL;
}
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);