bpo-28994: Fixed errors handling in atexit._run_exitfuncs(). (#2034)

The traceback no longer displayed for SystemExit raised in a callback registered by atexit.
This commit is contained in:
Serhiy Storchaka 2017-06-12 08:25:04 +03:00 committed by GitHub
parent 1dbce04d0e
commit 3fd54d4a7e
3 changed files with 14 additions and 1 deletions

View file

@ -97,7 +97,7 @@ atexit_callfuncs(void)
Py_XDECREF(exc_tb);
}
PyErr_Fetch(&exc_type, &exc_value, &exc_tb);
if (!PyErr_ExceptionMatches(PyExc_SystemExit)) {
if (!PyErr_GivenExceptionMatches(exc_type, PyExc_SystemExit)) {
PySys_WriteStderr("Error in atexit._run_exitfuncs:\n");
PyErr_NormalizeException(&exc_type, &exc_value, &exc_tb);
PyErr_Display(exc_type, exc_value, exc_tb);