You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Document how import chains are affected by sys.setrecursionlimit #128544
While working on a very large Python codebase, I ran into some undocumented behaviour.
A chain of imports (i.e. one module imports another, which imports another, which imports another) will cause a RecursionError to be raised if the Python recursion limit is not high enough. (Note, there is no recursion involved.)
From what I understand, this is a complex problem that is unlikely to be fixed. But I think it would be helpful to document this, probably in the docs for sys.setrecursionlimit.
I would be happy to try to do a pull request, assuming the core team agree that it should be added.
changed the title [-]Document how import chains are affected by sys.setrecursionlimit [/-][+]Document how import chains are affected by `sys.setrecursionlimit`[/+]on Jan 6, 2025
Activity
[-]Document how import chains are affected by sys.setrecursionlimit [/-][+]Document how import chains are affected by `sys.setrecursionlimit`[/+]pochmann3 commentedon Jan 6, 2025
Import chains are just one case. It's a more general issue, also see these:
#112215
#112282
seddonym commentedon Jan 7, 2025
Thanks for linking. I've asked on that second issue whether it would make sense to fold this issue into that one.