summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-19 12:33:35 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-19 12:33:35 (GMT)
commit2606a6f197a49f04611cb5cb0d67404d1ab14481 (patch)
tree35c228625105050ec2f593e6b362ce9e2498c760 /Modules
parent8a045cb93bded97220422a957941bb68341429d1 (diff)
downloadcpython-2606a6f197a49f04611cb5cb0d67404d1ab14481.zip
cpython-2606a6f197a49f04611cb5cb0d67404d1ab14481.tar.gz
cpython-2606a6f197a49f04611cb5cb0d67404d1ab14481.tar.bz2
Issue #16719: Get rid of WindowsError. Use OSError instead
Patch by Serhiy Storchaka.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/callproc.c36
-rw-r--r--Modules/_multiprocessing/multiprocessing.c4
-rw-r--r--Modules/posixmodule.c2
3 files changed, 21 insertions, 21 deletions
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 09320cf..058e04e 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -257,18 +257,18 @@ static void SetException(DWORD code, EXCEPTION_RECORD *pr)
to a virtual address for which it does not
have the appropriate access. */
if (pr->ExceptionInformation[0] == 0)
- PyErr_Format(PyExc_WindowsError,
+ PyErr_Format(PyExc_OSError,
"exception: access violation reading %p",
pr->ExceptionInformation[1]);
else
- PyErr_Format(PyExc_WindowsError,
+ PyErr_Format(PyExc_OSError,
"exception: access violation writing %p",
pr->ExceptionInformation[1]);
break;
case EXCEPTION_BREAKPOINT:
/* A breakpoint was encountered. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: breakpoint encountered");
break;
@@ -278,14 +278,14 @@ static void SetException(DWORD code, EXCEPTION_RECORD *pr)
alignment. For example, 16-bit values must be
aligned on 2-byte boundaries, 32-bit values on
4-byte boundaries, and so on. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: datatype misalignment");
break;
case EXCEPTION_SINGLE_STEP:
/* A trace trap or other single-instruction mechanism
signaled that one instruction has been executed. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: single step");
break;
@@ -293,7 +293,7 @@ static void SetException(DWORD code, EXCEPTION_RECORD *pr)
/* The thread attempted to access an array element
that is out of bounds, and the underlying hardware
supports bounds checking. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: array bounds exceeded");
break;
@@ -302,28 +302,28 @@ static void SetException(DWORD code, EXCEPTION_RECORD *pr)
is denormal. A denormal value is one that is too
small to represent as a standard floating-point
value. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: floating-point operand denormal");
break;
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
/* The thread attempted to divide a floating-point
value by a floating-point divisor of zero. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: float divide by zero");
break;
case EXCEPTION_FLT_INEXACT_RESULT:
/* The result of a floating-point operation cannot be
represented exactly as a decimal fraction. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: float inexact");
break;
case EXCEPTION_FLT_INVALID_OPERATION:
/* This exception represents any floating-point
exception not included in this list. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: float invalid operation");
break;
@@ -331,21 +331,21 @@ static void SetException(DWORD code, EXCEPTION_RECORD *pr)
/* The exponent of a floating-point operation is
greater than the magnitude allowed by the
corresponding type. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: float overflow");
break;
case EXCEPTION_FLT_STACK_CHECK:
/* The stack overflowed or underflowed as the result
of a floating-point operation. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: stack over/underflow");
break;
case EXCEPTION_STACK_OVERFLOW:
/* The stack overflowed or underflowed as the result
of a floating-point operation. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: stack overflow");
break;
@@ -353,21 +353,21 @@ static void SetException(DWORD code, EXCEPTION_RECORD *pr)
/* The exponent of a floating-point operation is less
than the magnitude allowed by the corresponding
type. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: float underflow");
break;
case EXCEPTION_INT_DIVIDE_BY_ZERO:
/* The thread attempted to divide an integer value by
an integer divisor of zero. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: integer divide by zero");
break;
case EXCEPTION_INT_OVERFLOW:
/* The result of an integer operation caused a carry
out of the most significant bit of the result. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: integer overflow");
break;
@@ -375,14 +375,14 @@ static void SetException(DWORD code, EXCEPTION_RECORD *pr)
/* The thread attempted to execute an instruction
whose operation is not allowed in the current
machine mode. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: priviledged instruction");
break;
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
/* The thread attempted to continue execution after a
noncontinuable exception occurred. */
- PyErr_SetString(PyExc_WindowsError,
+ PyErr_SetString(PyExc_OSError,
"exception: nocontinuable");
break;
diff --git a/Modules/_multiprocessing/multiprocessing.c b/Modules/_multiprocessing/multiprocessing.c
index 110eff7..a77c3b3 100644
--- a/Modules/_multiprocessing/multiprocessing.c
+++ b/Modules/_multiprocessing/multiprocessing.c
@@ -21,12 +21,12 @@ _PyMp_SetError(PyObject *Type, int num)
#ifdef MS_WINDOWS
case MP_STANDARD_ERROR:
if (Type == NULL)
- Type = PyExc_WindowsError;
+ Type = PyExc_OSError;
PyErr_SetExcFromWindowsErr(Type, 0);
break;
case MP_SOCKET_ERROR:
if (Type == NULL)
- Type = PyExc_WindowsError;
+ Type = PyExc_OSError;
PyErr_SetExcFromWindowsErr(Type, WSAGetLastError());
break;
#else /* !MS_WINDOWS */
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index cba3691..10368b2 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1041,7 +1041,7 @@ win32_error_object(char* function, PyObject* filename)
errno = GetLastError();
if (filename)
return PyErr_SetExcFromWindowsErrWithFilenameObject(
- PyExc_WindowsError,
+ PyExc_OSError,
errno,
filename);
else