diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-01-14 10:58:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-14 10:58:37 (GMT) |
commit | 6fe9c446f8302553952f63fc6d96be4dfa48ceba (patch) | |
tree | d69cdef7b520bbe12a3ef654ce1bb7d48ed76bd0 /Python | |
parent | 454b3d4ea246e8751534e105548d141ed7b0b032 (diff) | |
download | cpython-6fe9c446f8302553952f63fc6d96be4dfa48ceba.zip cpython-6fe9c446f8302553952f63fc6d96be4dfa48ceba.tar.gz cpython-6fe9c446f8302553952f63fc6d96be4dfa48ceba.tar.bz2 |
bpo-34756: Silence only ImportError and AttributeError in sys.breakpointhook(). (GH-9457)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/sysmodule.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 10707fd..869834b 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( |