diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-01-14 11:17:06 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-14 11:17:06 (GMT) |
| commit | 6d0254bae4d739b487fcaa76705a2d309bce8e75 (patch) | |
| tree | 5dca38752272b02c58cf8f96c3d95bcef60e04b7 /Python/sysmodule.c | |
| parent | 26122de1a80d1618ee80862cf3b8f73f8ec7d9cf (diff) | |
| download | cpython-6d0254bae4d739b487fcaa76705a2d309bce8e75.zip cpython-6d0254bae4d739b487fcaa76705a2d309bce8e75.tar.gz cpython-6d0254bae4d739b487fcaa76705a2d309bce8e75.tar.bz2 | |
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/sysmodule.c')
| -rw-r--r-- | Python/sysmodule.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index efe5b29..75e4f4b 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( |
