cpython: efcc48cd5bfb (original) (raw)
Mercurial > cpython
changeset 100690:efcc48cd5bfb
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" [#23848]
Victor Stinner victor.stinner@gmail.com | |
---|---|
date | Wed, 23 Mar 2016 14:44:14 +0100 |
parents | 9d3e7efbc85b |
children | e6f00778d61f |
files | Lib/test/test_faulthandler.py Modules/faulthandler.c |
diffstat | 2 files changed, 11 insertions(+), 4 deletions(-)[+] [-] Lib/test/test_faulthandler.py 2 Modules/faulthandler.c 13 |
line wrap: on
line diff
--- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -115,7 +115,7 @@ class FaultHandlerTests(unittest.TestCas self.check_error(code, line_number, fatal_error, **kw) def check_windows_exception(self, code, line_number, name_regex, **kw):
fatal_error = 'Windows exception: %s' % name_regex[](#l1.7)
fatal_error = 'Windows fatal exception: %s' % name_regex[](#l1.8) self.check_error(code, line_number, fatal_error, **kw)[](#l1.9)
@unittest.skipIf(sys.platform.startswith('aix'),
--- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -367,8 +367,15 @@ faulthandler_exc_handler(struct _EXCEPTI { const int fd = fatal_error.fd; DWORD code = exc_info->ExceptionRecord->ExceptionCode;
- /* only log fatal exceptions */
- if (flags & EXCEPTION_NONCONTINUABLE) {
/* call the next exception handler */[](#l2.12)
return EXCEPTION_CONTINUE_SEARCH;[](#l2.13)
- }
- PUTS(fd, "Windows fatal exception: "); switch (code) { /* only format most common errors */ @@ -380,8 +387,8 @@ faulthandler_exc_handler(struct _EXCEPTI case EXCEPTION_IN_PAGE_ERROR: PUTS(fd, "page error"); break; case EXCEPTION_STACK_OVERFLOW: PUTS(fd, "stack overflow"); break; default:
PUTS(fd, "code 0x");[](#l2.24)
_Py_DumpHexadecimal(fd, code, sizeof(DWORD));[](#l2.25)