diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-10-09 16:52:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-09 16:52:32 (GMT) |
commit | 6e3d6b5dc22cd06d8c4d44a38a8a3415e4bebb16 (patch) | |
tree | 06294a65e32fc53cf8fb8c895da8e6aeaea5298c /Modules | |
parent | c0cabc23bbe474d542ff8a4f1243f4ec3cce5549 (diff) | |
download | cpython-6e3d6b5dc22cd06d8c4d44a38a8a3415e4bebb16.zip cpython-6e3d6b5dc22cd06d8c4d44a38a8a3415e4bebb16.tar.gz cpython-6e3d6b5dc22cd06d8c4d44a38a8a3415e4bebb16.tar.bz2 |
bpo-31701: faulthandler: ignore MSC and COM Windows exception (#3929)
bpo-31701: On Windows, faulthandler.enable() now ignores MSC and COM
exceptions.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/faulthandler.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index c2c2c53..dba646b 100644 --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -360,6 +360,23 @@ faulthandler_fatal_error(int signum) } #ifdef MS_WINDOWS +static int +faulthandler_ignore_exception(DWORD code) +{ + /* bpo-30557: ignore exceptions which are not errors */ + if (!(code & 0x80000000)) { + return 1; + } + /* bpo-31701: ignore MSC and COM exceptions + E0000000 + code */ + if (code == 0xE06D7363 /* MSC exception ("Emsc") */ + || code == 0xE0434352 /* COM Callable Runtime exception ("ECCR") */) { + return 1; + } + /* Interesting exception: log it with the Python traceback */ + return 0; +} + static LONG WINAPI faulthandler_exc_handler(struct _EXCEPTION_POINTERS *exc_info) { @@ -367,9 +384,8 @@ faulthandler_exc_handler(struct _EXCEPTION_POINTERS *exc_info) DWORD code = exc_info->ExceptionRecord->ExceptionCode; DWORD flags = exc_info->ExceptionRecord->ExceptionFlags; - /* bpo-30557: only log fatal exceptions */ - if (!(code & 0x80000000)) { - /* call the next exception handler */ + if (faulthandler_ignore_exception(code)) { + /* ignore the exception: call the next exception handler */ return EXCEPTION_CONTINUE_SEARCH; } |