]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-34756: Silence only ImportError and AttributeError in sys.breakpointhook(). ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 14 Jan 2019 11:17:06 +0000 (03:17 -0800)
committerGitHub <noreply@github.com>
Mon, 14 Jan 2019 11:17:06 +0000 (03:17 -0800)
(cherry picked from commit 6fe9c446f8302553952f63fc6d96be4dfa48ceba)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Python/sysmodule.c

index efe5b29ef33c8103cfdae0bca9a9c6ffdeb99c1a..75e4f4bf294f22499f63b966109f215487855025 100644 (file)
@@ -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(