Commit cdcecdde authored by Stefan Behnel's avatar Stefan Behnel

do not call PyObject_IsSubclass() with an exception set (instead rely on it...

do not call PyObject_IsSubclass() with an exception set (instead rely on it being cleared when printing it before)
parent 7f8df733
...@@ -591,15 +591,14 @@ static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc ...@@ -591,15 +591,14 @@ static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc
__Pyx_ErrFetch(&exception, &value, &tb); __Pyx_ErrFetch(&exception, &value, &tb);
res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
// This function must not fail, so print the error here // This function must not fail, so print the error here (which also clears it)
if (unlikely(res == -1)) { if (unlikely(res == -1)) {
PyErr_WriteUnraisable(err); PyErr_WriteUnraisable(err);
res = 0; res = 0;
} }
if (!res) { if (!res) {
__Pyx_ErrRestore(exception, value, tb);
res = PyObject_IsSubclass(err, exc_type2); res = PyObject_IsSubclass(err, exc_type2);
// This function must not fail, so print the error here // This function must not fail, so print the error here (which also clears it)
if (unlikely(res == -1)) { if (unlikely(res == -1)) {
PyErr_WriteUnraisable(err); PyErr_WriteUnraisable(err);
res = 0; res = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment