diff options
author | scoder <stefan_ml@behnel.de> | 2017-07-31 20:27:46 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-07-31 20:27:46 (GMT) |
commit | e4c06bcca358c6dcb6393a75a1589ff6a2d45cde (patch) | |
tree | 68f6c40cff3c4159c0ba0c822776fcdd1ee28135 /Python/errors.c | |
parent | 8474d87165593bac2bc231287f42c4cff3fd6aaf (diff) | |
download | cpython-e4c06bcca358c6dcb6393a75a1589ff6a2d45cde.zip cpython-e4c06bcca358c6dcb6393a75a1589ff6a2d45cde.tar.gz cpython-e4c06bcca358c6dcb6393a75a1589ff6a2d45cde.tar.bz2 |
bpo-31091: Remove dead code in PyErr_GivenExceptionMatches(). (#2963)
According to the comment, there was previously a call to PyObject_IsSubclass() involved which could fail, but since it was replaced with a call to PyType_IsSubtype(), it can no longer fail.
Diffstat (limited to 'Python/errors.c')
-rw-r--r-- | Python/errors.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/Python/errors.c b/Python/errors.c index 3785e69..261dd7b 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -191,19 +191,7 @@ PyErr_GivenExceptionMatches(PyObject *err, PyObject *exc) err = PyExceptionInstance_Class(err); if (PyExceptionClass_Check(err) && PyExceptionClass_Check(exc)) { - int res = 0; - PyObject *exception, *value, *tb; - PyErr_Fetch(&exception, &value, &tb); - /* PyObject_IsSubclass() can recurse and therefore is - not safe (see test_bad_getattr in test.pickletester). */ - res = PyType_IsSubtype((PyTypeObject *)err, (PyTypeObject *)exc); - /* This function must not fail, so print the error here */ - if (res == -1) { - PyErr_WriteUnraisable(err); - res = 0; - } - PyErr_Restore(exception, value, tb); - return res; + return PyType_IsSubtype((PyTypeObject *)err, (PyTypeObject *)exc); } return err == exc; |