Infinite recursion after too many errors
embray opened this issue · comments
The following code, adapted from the doctests, results in a segfault:
from gappy import gap
x = [0, 1, 2]
for _ in range(0, 5000):
try:
_ = gap.Sum(*x)
except ValueError:
pass
The segfault is caught and handled by cysignals, but from thereafter other GAP errors result in a segfault as well.
However, replacing gap.Sum(*x)
with gap.eval('Sum(0, 1, 2)')
, although still resulting in a GAPError
, does not appear to lead to this condition. So I think the bug is probably local to GapFunction.__call__
. Though it's weird that it breaks all error handling.
Provided a fix for this in gap at gap-system/gap#4258 but I should see if there's a way I can work around it, maybe with wrappers for GAP_Enter/Leave.
Figured out exactly why the infinite recursion is happening, as explained here: gap-system/gap#4258 (comment)