Commit 8d001091 authored by Marius Wachtler's avatar Marius Wachtler

list_contains: fix exception api mismatch

parent d98f6eb0
......@@ -940,7 +940,7 @@ extern "C" Box* PyList_GetSlice(PyObject* a, Py_ssize_t ilow, Py_ssize_t ihigh)
return listGetitemSlice<CAPI>(self, new BoxedSlice(boxInt(ilow), boxInt(ihigh), boxInt(1)));
}
static inline int list_contains_shared(BoxedList* self, Box* elt) {
static inline int listContainsShared(BoxedList* self, Box* elt) {
assert(PyList_Check(self));
int size = self->size;
......@@ -962,7 +962,12 @@ static inline int list_contains_shared(BoxedList* self, Box* elt) {
}
static int list_contains(PyListObject* a, PyObject* el) noexcept {
return list_contains_shared((BoxedList*)a, el);
try {
return listContainsShared((BoxedList*)a, el);
} catch (ExcInfo e) {
setCAPIException(e);
return -1;
}
}
static PyObject* list_repeat(PyListObject* a, Py_ssize_t n) noexcept {
......@@ -1004,7 +1009,7 @@ static PyObject* list_repeat(PyListObject* a, Py_ssize_t n) noexcept {
}
Box* listContains(BoxedList* self, Box* elt) {
return boxBool(list_contains_shared(self, elt));
return boxBool(listContainsShared(self, elt));
}
Box* listCount(BoxedList* self, Box* elt) {
......
......@@ -211,3 +211,11 @@ print l
"""
print repr(list.__hash__)
class RaisingCmp(object):
def __eq__(self, other):
1/0
try:
RaisingCmp() in [1, 2, 3]
except ZeroDivisionError as e:
print e
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