Open seblabbe opened 2 months ago
Adding sig_on and sig_off around the call to next_triangulation
at least avoids sage to get killed:
diff --git a/src/sage/geometry/triangulation/base.pyx b/src/sage/geometry/triangulation/base.pyx
index 61014429fdd..89bf439067f 100644
--- a/src/sage/geometry/triangulation/base.pyx
+++ b/src/sage/geometry/triangulation/base.pyx
@@ -31,6 +31,7 @@ from sage.geometry.triangulation.functions cimport binomial
from sage.geometry.triangulation.triangulations cimport \
triangulations_ptr, init_triangulations, next_triangulation, delete_triangulations
+from cysignals.signals cimport sig_on, sig_off
########################################################################
cdef class Point(SageObject):
@@ -986,7 +987,9 @@ cdef class ConnectedTriangulationsIterator(SageObject):
sage: ci.__next__()
(9, 10)
"""
+ sig_on()
t = next_triangulation(self._tp)
+ sig_off()
if not t:
raise StopIteration
return t
These are the changes that have been made on the file triangulations.cc
since 13 years:
$ git lg src/sage/geometry/triangulation/triangulations.cc
* 439a4ece6b7 - using PyLong API instead of legacy PyInt API (il y a 10 mois) [Frédéric Chapoton]
* b4cf6701caf - (origin/u/galois/mrs/46/size_t) Fix some compiler warnings, mostly use size_t for indexing (il y a 3 ans et 11 mois) [Ivan Komarov]
* 657c3e6db11 - Trac #13899: Fix indentation and trailing spaces (il y a 11 ans) [Jeroen Demeyer]
* 95cfa8a9e5e - Trac 9918: Triangulate point configurations (il y a 13 ans) [Volker Braun]
The code was written by @vbraun in the first place. Maybe he has an idea on what could be done to fix the issue?
Steps To Reproduce
Expected Behavior
It should print all of the expected 2002 triangulations:
Actual Behavior
It hangs and sage exits by itself (without keyboard interrupt) after printing the 1476-th :
Sometimes, it also says
Cannot allocate memory
after printing a cysygnal traceback involvingnext_triangulation
andbad_alloc
type of error:Additional Information
First reported by Florent Koechlin on ask.sagemath.org here: https://ask.sagemath.org/question/77736/computing-triangulations-fails/
Environment
Checklist