-
-
Notifications
You must be signed in to change notification settings - Fork 497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
importing jedi might lower your recursion limit #1925
Comments
Completely agree. This should be a decorator. We discussed this here already Feel free to send a pull request that sets the recusion limit in specific places and resets it afterwards. |
See sagemath/sage#35803 for an (admittedly dubious) example of this happening in the wild. |
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: