summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/errors.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 9c9eb2f..d7aac6d 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -160,11 +160,12 @@ PyErr_GivenExceptionMatches(PyObject *err, PyObject *exc)
int res = 0;
PyObject *exception, *value, *tb;
PyErr_Fetch(&exception, &value, &tb);
- res = PyObject_IsSubclass(err, exc);
+ /* 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);
- /* issubclass did not succeed */
res = 0;
}
PyErr_Restore(exception, value, tb);