Commit 84c97afb authored by Thomas Heller's avatar Thomas Heller

Merged revisions 71906 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r71906 | thomas.heller | 2009-04-25 18:37:18 +0200 (Sa, 25 Apr 2009) | 1 line

  Issue #5078: Avoid redundant call to FormatError()
........
parent 1b08b307
......@@ -229,14 +229,12 @@ static WCHAR *FormatError(DWORD code)
}
#ifndef DONT_USE_SEH
void SetException(DWORD code, EXCEPTION_RECORD *pr)
static void SetException(DWORD code, EXCEPTION_RECORD *pr)
{
WCHAR *lpMsgBuf;
lpMsgBuf = FormatError(code);
if(lpMsgBuf) {
PyErr_SetFromWindowsErr(code);
LocalFree(lpMsgBuf);
} else {
/* The 'code' is a normal win32 error code so it could be handled by
PyErr_SetFromWindowsErr(). However, for some errors, we have additional
information not included in the error code. We handle those here and
delegate all others to the generic function. */
switch (code) {
case EXCEPTION_ACCESS_VIOLATION:
/* The thread attempted to read from or write
......@@ -251,6 +249,7 @@ void SetException(DWORD code, EXCEPTION_RECORD *pr)
"exception: access violation writing %p",
pr->ExceptionInformation[1]);
break;
case EXCEPTION_BREAKPOINT:
/* A breakpoint was encountered. */
PyErr_SetString(PyExc_WindowsError,
......@@ -370,14 +369,11 @@ void SetException(DWORD code, EXCEPTION_RECORD *pr)
PyErr_SetString(PyExc_WindowsError,
"exception: nocontinuable");
break;
default:
printf("error %d\n", code);
PyErr_Format(PyExc_WindowsError,
"exception code 0x%08x",
code);
PyErr_SetFromWindowsErr(code);
break;
}
}
}
static DWORD HandleException(EXCEPTION_POINTERS *ptrs,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment