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 /PC | |
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 'PC')
-rw-r--r-- | PC/clinic/msvcrtmodule.c.h | 6 | ||||
-rw-r--r-- | PC/msvcrtmodule.c | 24 |
2 files changed, 15 insertions, 15 deletions
diff --git a/PC/clinic/msvcrtmodule.c.h b/PC/clinic/msvcrtmodule.c.h index db4f46e..2c8303b 100644 --- a/PC/clinic/msvcrtmodule.c.h +++ b/PC/clinic/msvcrtmodule.c.h @@ -29,7 +29,7 @@ PyDoc_STRVAR(msvcrt_locking__doc__, "\n" "Lock part of a file based on file descriptor fd from the C runtime.\n" "\n" -"Raises IOError on failure. The locked region of the file extends from\n" +"Raises OSError on failure. The locked region of the file extends from\n" "the current file position for nbytes bytes, and may continue beyond\n" "the end of the file. mode must be one of the LK_* constants listed\n" "below. Multiple regions in a file may be locked at the same time, but\n" @@ -155,7 +155,7 @@ PyDoc_STRVAR(msvcrt_get_osfhandle__doc__, "\n" "Return the file handle for the file descriptor fd.\n" "\n" -"Raises IOError if fd is not recognized."); +"Raises OSError if fd is not recognized."); #define MSVCRT_GET_OSFHANDLE_METHODDEF \ {"get_osfhandle", (PyCFunction)msvcrt_get_osfhandle, METH_O, msvcrt_get_osfhandle__doc__}, @@ -589,4 +589,4 @@ exit: #ifndef MSVCRT_SET_ERROR_MODE_METHODDEF #define MSVCRT_SET_ERROR_MODE_METHODDEF #endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */ -/*[clinic end generated code: output=36f1e78ca8bd3944 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=be516d0e78532ba3 input=a9049054013a1b77]*/ diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index 4797cdc..59bf54f 100644 --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -82,7 +82,7 @@ msvcrt_heapmin_impl(PyObject *module) /*[clinic end generated code: output=1ba00f344782dc19 input=82e1771d21bde2d8]*/ { if (_heapmin() != 0) - return PyErr_SetFromErrno(PyExc_IOError); + return PyErr_SetFromErrno(PyExc_OSError); Py_RETURN_NONE; } @@ -96,7 +96,7 @@ msvcrt.locking Lock part of a file based on file descriptor fd from the C runtime. -Raises IOError on failure. The locked region of the file extends from +Raises OSError on failure. The locked region of the file extends from the current file position for nbytes bytes, and may continue beyond the end of the file. mode must be one of the LK_* constants listed below. Multiple regions in a file may be locked at the same time, but @@ -106,7 +106,7 @@ individually. static PyObject * msvcrt_locking_impl(PyObject *module, int fd, int mode, long nbytes) -/*[clinic end generated code: output=a4a90deca9785a03 input=d9f13f0f6a713ba7]*/ +/*[clinic end generated code: output=a4a90deca9785a03 input=e97bd15fc4a04fef]*/ { int err; @@ -116,7 +116,7 @@ msvcrt_locking_impl(PyObject *module, int fd, int mode, long nbytes) _Py_END_SUPPRESS_IPH Py_END_ALLOW_THREADS if (err != 0) - return PyErr_SetFromErrno(PyExc_IOError); + return PyErr_SetFromErrno(PyExc_OSError); Py_RETURN_NONE; } @@ -144,7 +144,7 @@ msvcrt_setmode_impl(PyObject *module, int fd, int flags) flags = _setmode(fd, flags); _Py_END_SUPPRESS_IPH if (flags == -1) - PyErr_SetFromErrno(PyExc_IOError); + PyErr_SetFromErrno(PyExc_OSError); return flags; } @@ -173,7 +173,7 @@ msvcrt_open_osfhandle_impl(PyObject *module, intptr_t handle, int flags) fd = _open_osfhandle(handle, flags); _Py_END_SUPPRESS_IPH if (fd == -1) - PyErr_SetFromErrno(PyExc_IOError); + PyErr_SetFromErrno(PyExc_OSError); return fd; } @@ -186,12 +186,12 @@ msvcrt.get_osfhandle -> handle Return the file handle for the file descriptor fd. -Raises IOError if fd is not recognized. +Raises OSError if fd is not recognized. [clinic start generated code]*/ static intptr_t msvcrt_get_osfhandle_impl(PyObject *module, int fd) -/*[clinic end generated code: output=7ce761dd0de2b503 input=c7d18d02c8017ec1]*/ +/*[clinic end generated code: output=7ce761dd0de2b503 input=305900f4bfab76c7]*/ { intptr_t handle = -1; @@ -199,7 +199,7 @@ msvcrt_get_osfhandle_impl(PyObject *module, int fd) handle = _get_osfhandle(fd); _Py_END_SUPPRESS_IPH if (handle == -1) - PyErr_SetFromErrno(PyExc_IOError); + PyErr_SetFromErrno(PyExc_OSError); return handle; } @@ -359,7 +359,7 @@ msvcrt_ungetch_impl(PyObject *module, char char_value) _Py_END_SUPPRESS_IPH if (res == EOF) - return PyErr_SetFromErrno(PyExc_IOError); + return PyErr_SetFromErrno(PyExc_OSError); Py_RETURN_NONE; } @@ -383,7 +383,7 @@ msvcrt_ungetwch_impl(PyObject *module, int unicode_char) _Py_END_SUPPRESS_IPH if (res == WEOF) - return PyErr_SetFromErrno(PyExc_IOError); + return PyErr_SetFromErrno(PyExc_OSError); Py_RETURN_NONE; } @@ -435,7 +435,7 @@ msvcrt_CrtSetReportMode_impl(PyObject *module, int type, int mode) res = _CrtSetReportMode(type, mode); _Py_END_SUPPRESS_IPH if (res == -1) - PyErr_SetFromErrno(PyExc_IOError); + PyErr_SetFromErrno(PyExc_OSError); return res; } |