Question: "Execution stopped: Stack limit reached." - Possible problem with gfun package?

As a Maple user for 10+ years, I've had plenty of stack limit errors, pretty much all of them my fault. But I am currently experiencing a very unusual one after updating my Mac from Maple 2019 to Maple 2021.2.

I am running a long script to fetch json data from a url, parse it, and do a bunch of analysis. In most cases it works fine, but some cases give either an "Execution stopped: Stack limit reached." error, or the error "Error, (in type/polynom) result from type `algfun` must be true or false". Both are being caused by calling the gfun:-ratpolytocoeff command.

I kind of think some internal memory of Maple is being accidentally overwritten because I can cause the error to occur or not occur by adding / commenting out random lines of code that have nothing to do with the part of the code causing the problem. I've managed to find a fairly small script that causes the problem to occur:

with(PolynomialIdeals):
url := "https://api.combopal.ru.is/garpur_run/61e5f7acf2e929ff811caad3":

root_func := F[0, x]:

latex:-Settings(useimaginaryunit=i):

data := URL[Get](url):
json := JSON[ParseString](data):
json := JSON[ParseString](data):

debug_solved := (x^5-3*x^4+5*x^3-7*x^2+4*x-1)/(x^5-5*x^4+10*x^3-10*x^2+5*x-1):

debug_gfun := gfun[ratpolytocoeff](debug_solved, x, n);

If I remove ANY of these lines of code, there is no longer any problem, which is very strange because, for example, I'm not using the PolynomialIdeals package anywhere in the script. This particular script works fine on a Linux machine running 2021.0, but yet I am having similar problems on that machine with other cases.

Here's a slightly simpler example in which gfun[ratpolytocoeff] induces a "division by zero" error ("Error, (in convert/fullparfrac/normal_only) numeric exception: division by zero"):

with(PolynomialIdeals):
url := "https://api.combopal.ru.is/garpur_run/61e5f7acf2e929ff811caad3":

latex:-Settings(useimaginaryunit=i):

data := URL[Get](url):
json := JSON[ParseString](data):
json := JSON[ParseString](data):

debug_gfun := gfun[ratpolytocoeff](1/(1-x), x, n);

After the division by zero error, if I press Ctrl+D to close the Maple command line, it prints
"GC Thread signalAbort 0x7000019a5000 Execution stopped: Stack limit reached.".

Is this an internal Maple bug? Is there any workaround? I am pulling my hair out and would be very grateful for any help.

Please Wait...