Commit 94d982d8 authored by Stefan Behnel's avatar Stefan Behnel

repair "except" on tuples

parent 0a8a04af
...@@ -35,6 +35,17 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta ...@@ -35,6 +35,17 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta
PyObject *exc_type = tstate->curexc_type; PyObject *exc_type = tstate->curexc_type;
if (exc_type == err) return 1; if (exc_type == err) return 1;
if (unlikely(!exc_type)) return 0; if (unlikely(!exc_type)) return 0;
if (unlikely(PyTuple_Check(err))) {
Py_ssize_t i, n;
n = PyTuple_GET_SIZE(err);
for (i=0; i<n; i++) {
if (exc_type == PyTuple_GET_ITEM(err, i)) return 1;
}
for (i=0; i<n; i++) {
if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(err, i))) return 1;
}
return 0;
}
return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
} }
#endif #endif
......
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