From: Serhiy Storchaka Date: Mon, 14 Jan 2019 10:58:37 +0000 (+0200) Subject: bpo-34756: Silence only ImportError and AttributeError in sys.breakpointhook(). ... X-Git-Tag: v3.8.0a1~98 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6fe9c446f8302553952f63fc6d96be4dfa48ceba;p=thirdparty%2FPython%2Fcpython.git bpo-34756: Silence only ImportError and AttributeError in sys.breakpointhook(). (GH-9457) --- diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 10707fd23fc6..869834b92432 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -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(