Skip to content

Commit e93a360

Browse files
committed
don't ignore errors in method union of DisjointSet
1 parent 209ae4c commit e93a360

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/sage/sets/disjoint_set.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ cdef class DisjointSet_of_hashables(DisjointSet_class):
2929
cdef list _int_to_el
3030
cdef dict _el_to_int
3131
cpdef find(self, e)
32-
cpdef void union(self, e, f) noexcept
32+
cpdef void union(self, e, f) except *
3333
cpdef root_to_elements_dict(self)
3434
cpdef element_to_root_dict(self)
3535
cpdef to_digraph(self)

src/sage/sets/disjoint_set.pyx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ cdef class DisjointSet_of_hashables(DisjointSet_class):
833833
cdef int r = <int> OP_find(self._nodes, i)
834834
return self._int_to_el[r]
835835

836-
cpdef void union(self, e, f) noexcept:
836+
cpdef void union(self, e, f) except *:
837837
r"""
838838
Combine the set of ``e`` and the set of ``f`` into one.
839839
@@ -861,8 +861,9 @@ cdef class DisjointSet_of_hashables(DisjointSet_class):
861861
sage: e
862862
{{'a', 'b', 'c', 'e'}, {'d'}}
863863
sage: e.union('a', 2**10)
864-
KeyError: 1024
864+
Traceback (most recent call last):
865865
...
866+
KeyError: 1024
866867
"""
867868
cdef int i = <int> self._el_to_int[e]
868869
cdef int j = <int> self._el_to_int[f]

0 commit comments

Comments
 (0)