A recursive function calls itself indefinitely without hitting a valid base case.
Python guards against stack overflow by placing a maximum call stack limit (default 1000 frames). When a function recursively calls itself too many times, Python raises `RecursionError`.
Missing base case in a recursive algorithm, invalid recursive step where parameters do not move closer to the base case, or deeply nested tree/graph traversals.
1def factorial(n):2 # Bug: missing base case (if n <= 1: return 1)3 return n * factorial(n - 1)4 5factorial(5) # RecursionError: maximum recursion depth exceeded1def factorial(n):2 if n <= 1:3 return 1 # Base case stops recursion4 return n * factorial(n - 1)5 6print(factorial(5)) # Output: 120Simulate standard system builds to trigger compiler trace records and track memory crashes locally.
Without `if n <= 1: return 1`, `factorial(5)` calls `factorial(4)`, `factorial(3)`... past 0 into -1000, exceeding Python's call stack limit.