bpo-34756: Silence only ImportError and AttributeError in sys.breakpointhook(). (GH-9457)

(cherry picked from commit 6fe9c446f8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2019-01-14 03:17:06 -08:00 committed by GitHub
parent 26122de1a8
commit 6d0254bae4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -171,6 +171,12 @@ sys_breakpointhook(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
return retval;
error:
if (!PyErr_ExceptionMatches(PyExc_ImportError)
&& !PyErr_ExceptionMatches(PyExc_AttributeError))
{
PyMem_RawFree(envar);
return NULL;
}
/* If any of the imports went wrong, then warn and ignore. */
PyErr_Clear();
int status = PyErr_WarnFormat(