summaryrefslogtreecommitdiffstats
path: root/Modules/faulthandler.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-03-23 13:44:14 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-03-23 13:44:14 (GMT)
commit412a5e7e2349689ab408c9475401c83886108e75 (patch)
treea0be3cf75dd62a62ac7574c16ff585f139aef0d7 /Modules/faulthandler.c
parentb9e0834f468b9c6c0fa1f2758971a3182e3cd863 (diff)
downloadcpython-412a5e7e2349689ab408c9475401c83886108e75.zip
cpython-412a5e7e2349689ab408c9475401c83886108e75.tar.gz
cpython-412a5e7e2349689ab408c9475401c83886108e75.tar.bz2
faulthandler: only log fatal exceptions
Issue #23848, #26622: * faulthandler now only logs fatal Windows exceptions. * write error code as decimal, not as hexadecimal * replace "Windows exception" with "Windows fatal exception"
Diffstat (limited to 'Modules/faulthandler.c')
-rw-r--r--Modules/faulthandler.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index 2214466..e86f2bb 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -367,8 +367,15 @@ faulthandler_exc_handler(struct _EXCEPTION_POINTERS *exc_info)
{
const int fd = fatal_error.fd;
DWORD code = exc_info->ExceptionRecord->ExceptionCode;
+ DWORD flags = exc_info->ExceptionRecord->ExceptionFlags;
- PUTS(fd, "Windows exception: ");
+ /* only log fatal exceptions */
+ if (flags & EXCEPTION_NONCONTINUABLE) {
+ /* call the next exception handler */
+ return EXCEPTION_CONTINUE_SEARCH;
+ }
+
+ PUTS(fd, "Windows fatal exception: ");
switch (code)
{
/* only format most common errors */
@@ -380,8 +387,8 @@ faulthandler_exc_handler(struct _EXCEPTION_POINTERS *exc_info)
case EXCEPTION_IN_PAGE_ERROR: PUTS(fd, "page error"); break;
case EXCEPTION_STACK_OVERFLOW: PUTS(fd, "stack overflow"); break;
default:
- PUTS(fd, "code 0x");
- _Py_DumpHexadecimal(fd, code, sizeof(DWORD));
+ PUTS(fd, "code ");
+ _Py_DumpDecimal(fd, code, sizeof(DWORD));
}
PUTS(fd, "\n\n");