diff --git a/src/sage/sets/disjoint_set.pxd b/src/sage/sets/disjoint_set.pxd index 4d981718568..98f02ad4897 100644 --- a/src/sage/sets/disjoint_set.pxd +++ b/src/sage/sets/disjoint_set.pxd @@ -29,7 +29,7 @@ cdef class DisjointSet_of_hashables(DisjointSet_class): cdef list _int_to_el cdef dict _el_to_int cpdef find(self, e) - cpdef void union(self, e, f) noexcept + cpdef void union(self, e, f) except * cpdef root_to_elements_dict(self) cpdef element_to_root_dict(self) cpdef to_digraph(self) diff --git a/src/sage/sets/disjoint_set.pyx b/src/sage/sets/disjoint_set.pyx index ddd9a95a310..c2cce67037f 100644 --- a/src/sage/sets/disjoint_set.pyx +++ b/src/sage/sets/disjoint_set.pyx @@ -833,7 +833,7 @@ cdef class DisjointSet_of_hashables(DisjointSet_class): cdef int r = OP_find(self._nodes, i) return self._int_to_el[r] - cpdef void union(self, e, f) noexcept: + cpdef void union(self, e, f) except *: r""" Combine the set of ``e`` and the set of ``f`` into one. @@ -861,8 +861,9 @@ cdef class DisjointSet_of_hashables(DisjointSet_class): sage: e {{'a', 'b', 'c', 'e'}, {'d'}} sage: e.union('a', 2**10) - KeyError: 1024 + Traceback (most recent call last): ... + KeyError: 1024 """ cdef int i = self._el_to_int[e] cdef int j = self._el_to_int[f]