[Python-checkins] bpo-34756: Silence only ImportError and AttributeError in sys.breakpointhook(). (GH-9457)
Serhiy Storchaka
webhook-mailer at python.org
Mon Jan 14 05:58:43 EST 2019
https://github.com/python/cpython/commit/6fe9c446f8302553952f63fc6d96be4dfa48ceba
commit: 6fe9c446f8302553952f63fc6d96be4dfa48ceba
branch: master
author: Serhiy Storchaka <storchaka at gmail.com>
committer: GitHub <noreply at github.com>
date: 2019-01-14T12:58:37+02:00
summary:
bpo-34756: Silence only ImportError and AttributeError in sys.breakpointhook(). (GH-9457)
files:
M Python/sysmodule.c
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(
More information about the Python-checkins
mailing list