bpo-34756: Silence only ImportError and AttributeError in sys.breakpo… · python/cpython@6fe9c44 (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit 6fe9c44

bpo-34756: Silence only ImportError and AttributeError in sys.breakpointhook(). (GH-9457)

File tree

1 file changed

lines changed

1 file changed

lines changed

Original file line number Diff line number Diff line change
@@ -170,6 +170,12 @@ sys_breakpointhook(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
170 170 return retval;
171 171
172 172 error:
173 +if (!PyErr_ExceptionMatches(PyExc_ImportError)
174 +&& !PyErr_ExceptionMatches(PyExc_AttributeError))
175 + {
176 +PyMem_RawFree(envar);
177 +return NULL;
178 + }
173 179 /* If any of the imports went wrong, then warn and ignore. */
174 180 PyErr_Clear();
175 181 int status = PyErr_WarnFormat(