0

I have implemented recursive functions that work on big database and it raises

RecursionError: maximum recursion depth exceeded while calling a Python object

To solve it I added sys.setrecursionlimit(10 ** 4) at the beginning of my code. But now, when I run my program, it crashes with the message :

Process finished with exit code -1073741571 (0xC00000FD)

What is this error and how do I solve it? Or is there an other way to avoid Recursion Errors?

S.B
  • 13,077
  • 10
  • 22
  • 49
Tom Lai
  • 1
  • 2
  • 4
    A recursion depth of 10 ** 4 seems to be quite big. Do you expect this depth? If yes, you might have to find a different solution. – Matthias Apr 25 '22 at 14:34
  • 2
    The 0xC00000FD error is stack overflow. This is what the default recursion limit protects from. Can you share more information about your code? – Yoav Sheetrit Apr 25 '22 at 15:24
  • 1
    Really, the only way to solve this is to not use recursion, especially recursion that results in a linear recursion tree. While there are methods to mechanically convert any kind of recursion into stack-safe code (tail-call optimization, trampolines, etc), Python does not implement any of them. – chepner Apr 25 '22 at 15:32

0 Answers0