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

This commit is contained in:
Serhiy Storchaka 2019-01-14 12:58:37 +02:00 committed by GitHub
parent 454b3d4ea2
commit 6fe9c446f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -170,6 +170,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(