If this helped you, please share!

TIL: Python recursion limits

Published September 27, 2022 in today I learned - 0 Comments

Today I learned that you can get (sys.getrecursionlimit()) and set (sys.setrecursionlimit(limit)) the Python interpreter’s maximum stack depth. I can see that on my system, the maximum stack depth or recursion limit is 3000. Exceeding the limit results in a RecursionError.

sys recursionlimit in ipython

This came up in a Prefect flow using a LocalDaskExecutor that attempted to serialize an object with cloudpickle that failed with RecursionError.

Tags: python

No comments yet

Leave a Reply: