Commit 5e7d4765 authored by Stefan Behnel's avatar Stefan Behnel

Merge branch '0.28.x'

parents 7cf517e2 4fbce714
...@@ -811,7 +811,11 @@ static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject * ...@@ -811,7 +811,11 @@ static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *
#if PY_MAJOR_VERSION < 3 #if PY_MAJOR_VERSION < 3
if (likely(exc_type == t)) return 1; if (likely(exc_type == t)) return 1;
#endif #endif
if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1; if (likely(PyExceptionClass_Check(t))) {
if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
} else {
// FIXME: Py3: PyErr_SetString(PyExc_TypeError, "catching classes that do not inherit from BaseException is not allowed");
}
} }
return 0; return 0;
} }
...@@ -819,15 +823,19 @@ static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject * ...@@ -819,15 +823,19 @@ static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
if (likely(err == exc_type)) return 1; if (likely(err == exc_type)) return 1;
if (likely(PyExceptionClass_Check(err))) { if (likely(PyExceptionClass_Check(err))) {
if (unlikely(PyTuple_Check(exc_type))) { if (likely(PyExceptionClass_Check(exc_type))) {
return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
} else if (likely(PyTuple_Check(exc_type))) {
return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
} else {
// FIXME: Py3: PyErr_SetString(PyExc_TypeError, "catching classes that do not inherit from BaseException is not allowed");
} }
return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
} }
return PyErr_GivenExceptionMatches(err, exc_type); return PyErr_GivenExceptionMatches(err, exc_type);
} }
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
// Only used internally with known exception types => pure safety check assertions.
assert(PyExceptionClass_Check(exc_type1)); assert(PyExceptionClass_Check(exc_type1));
assert(PyExceptionClass_Check(exc_type2)); assert(PyExceptionClass_Check(exc_type2));
if (likely(err == exc_type1 || err == exc_type2)) return 1; if (likely(err == exc_type1 || err == exc_type2)) return 1;
......
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