[Python-checkins] bpo-34756: Silence only ImportError and AttributeError in sys.breakpointhook(). (GH-9457)
Miss Islington (bot)
webhook-mailer at python.org
Mon Jan 14 06:17:11 EST 2019
https://github.com/python/cpython/commit/6d0254bae4d739b487fcaa76705a2d309bce8e75
commit: 6d0254bae4d739b487fcaa76705a2d309bce8e75
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-01-14T03:17:06-08:00
summary:
bpo-34756: Silence only ImportError and AttributeError in sys.breakpointhook(). (GH-9457)
(cherry picked from commit 6fe9c446f8302553952f63fc6d96be4dfa48ceba)
Co-authored-by: Serhiy Storchaka <storchaka at gmail.com>
files:
M Python/sysmodule.c
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index efe5b29ef33c..75e4f4bf294f 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(
More information about the Python-checkins
mailing list