Skip to content

Commit 4e90280

Browse files
committed
Merge branch 'u/mantepse/allow_to_remove_no_constraints' of trac.sagemath.org:sage into t/33238/a_bijectionist_s_toolkit
2 parents d8a0663 + b03cf22 commit 4e90280

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/sage/numerical/mip.pyx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2366,11 +2366,20 @@ cdef class MixedIntegerLinearProgram(SageObject):
23662366
....: p.add_constraint(x - y, max=10)
23672367
sage: p.number_of_constraints()
23682368
3
2369+
2370+
TESTS:
2371+
2372+
Removing no constraints does not make Sage crash, see
2373+
:trac:`34881`::
2374+
2375+
sage: MixedIntegerLinearProgram().remove_constraints([])
2376+
23692377
"""
23702378
if self._check_redundant:
23712379
for i in sorted(constraints, reverse=True):
23722380
self._constraints.pop(i)
2373-
self._backend.remove_constraints(constraints)
2381+
if constraints:
2382+
self._backend.remove_constraints(constraints)
23742383

23752384
def set_binary(self, ee):
23762385
r"""

0 commit comments

Comments
 (0)