diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-01-14 12:58:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-14 12:58:37 +0200 |
commit | 6fe9c446f8302553952f63fc6d96be4dfa48ceba (patch) | |
tree | d69cdef7b520bbe12a3ef654ce1bb7d48ed76bd0 /Python/sysmodule.c | |
parent | 454b3d4ea246e8751534e105548d141ed7b0b032 (diff) | |
download | cpython-git-6fe9c446f8302553952f63fc6d96be4dfa48ceba.tar.gz |
bpo-34756: Silence only ImportError and AttributeError in sys.breakpointhook(). (GH-9457)
Diffstat (limited to 'Python/sysmodule.c')
-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 10707fd23f..869834b924 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( |