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
# Jedi uses lots and lots of recursion. By setting this a little bit higher, we
# can remove some "maximum recursion depth" errors.
sys.setrecursionlimit(3000)
Perhaps it should check if you're not already higher than 3000, so that you're not lowering an already higher bound which user might have set for a good reason.
Actually, I think it's questionable for a library to mess with the global recursion limit in the first place - maybe the parts of jedi which need to use deep recursion can do so with a context-managed recursion limit, or be rewritten to use an explicit stack.
The text was updated successfully, but these errors were encountered:
Actually, I think it's questionable for a library to mess with the global recursion limit in the first place - maybe the parts of jedi which need to use deep recursion can do so with a context-managed recursion limit, or be rewritten to use an explicit stack.
Completely agree. This should be a decorator. We discussed this here already dask/dask#9805 and to a lesser degree here: #1902.
Feel free to send a pull request that sets the recusion limit in specific places and resets it afterwards.
There's another side to this: 3000 may be too high in some scenarios, and may cause CPython to crash instead of throwing an exception. I've seen it multiple times now, when jedi was imported implicitly via some other package and then caused e.g. django tests to crash.
In https://github.com/davidhalter/jedi/blob/v0.18.2/jedi/api/__init__.py#L46-L48
Perhaps it should check if you're not already higher than 3000, so that you're not lowering an already higher bound which user might have set for a good reason.
Actually, I think it's questionable for a library to mess with the global recursion limit in the first place - maybe the parts of jedi which need to use deep recursion can do so with a context-managed recursion limit, or be rewritten to use an explicit stack.
The text was updated successfully, but these errors were encountered: