I have this tail-recursive function here:

def fib(n, sum):

if n < 1:

return sum

else:

return fib(n-1, sum+n)

c = 998

print(fib(c, 0))

It works up to n=997, then it just breaks and spits a "maximum recursion depth exceeded in comparison" `RuntimeError`

. Is this just a stack overflow? Is there a way to get around it?