bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051)

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 @@
         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 @@
         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;
     }