Get the number of available frames before RecursionError. It depends on the current recursion depth of the caller function and sys.getrecursionlimit().
()
| 2493 | return max(depth - 1, 1) |
| 2494 | |
| 2495 | def get_recursion_available(): |
| 2496 | """Get the number of available frames before RecursionError. |
| 2497 | |
| 2498 | It depends on the current recursion depth of the caller function and |
| 2499 | sys.getrecursionlimit(). |
| 2500 | """ |
| 2501 | limit = sys.getrecursionlimit() |
| 2502 | depth = get_recursion_depth() |
| 2503 | return limit - depth |
| 2504 | |
| 2505 | @contextlib.contextmanager |
| 2506 | def set_recursion_limit(limit): |
nothing calls this directly
no test coverage detected
searching dependent graphs…