]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-34756: Silence only ImportError and AttributeError in sys.breakpointhook(). ...
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 14 Jan 2019 10:58:37 +0000 (12:58 +0200)
committerGitHub <noreply@github.com>
Mon, 14 Jan 2019 10:58:37 +0000 (12:58 +0200)
Python/sysmodule.c

index 10707fd23fc628f860ee55dbe6f59884a61be551..869834b92432599b541f99fa20167903b021d6f4 100644 (file)
@@ -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(