summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-01-14 03:17:06 -0800
committerGitHub <noreply@github.com>2019-01-14 03:17:06 -0800
commit6d0254bae4d739b487fcaa76705a2d309bce8e75 (patch)
tree5dca38752272b02c58cf8f96c3d95bcef60e04b7 /Python
parent26122de1a80d1618ee80862cf3b8f73f8ec7d9cf (diff)
downloadcpython-git-6d0254bae4d739b487fcaa76705a2d309bce8e75.tar.gz
bpo-34756: Silence only ImportError and AttributeError in sys.breakpointhook(). (GH-9457)
(cherry picked from commit 6fe9c446f8302553952f63fc6d96be4dfa48ceba) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Python')
-rw-r--r--Python/sysmodule.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index efe5b29ef3..75e4f4bf29 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -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(