Skip to content

Commit 6fe9c44

Browse files
bpo-34756: Silence only ImportError and AttributeError in sys.breakpointhook(). (GH-9457)
1 parent 454b3d4 commit 6fe9c44

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Python/sysmodule.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ sys_breakpointhook(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
170170
return retval;
171171

172172
error:
173+
if (!PyErr_ExceptionMatches(PyExc_ImportError)
174+
&& !PyErr_ExceptionMatches(PyExc_AttributeError))
175+
{
176+
PyMem_RawFree(envar);
177+
return NULL;
178+
}
173179
/* If any of the imports went wrong, then warn and ignore. */
174180
PyErr_Clear();
175181
int status = PyErr_WarnFormat(

0 commit comments

Comments
 (0)