davidhalter / davidhalter/jedi
importing jedi might lower your recursion limit
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 535
- PR merge metrics
- No merged PRs in 30d
Description
```
>>> sys.setrecursionlimit(5000)
>>> sys.getrecursionlimit()
5000
>>> import jedi
>>> sys.getrecursionlimit()
3000
```
In https://github.com/davidhalter/jedi/blob/v0.18.2/jedi/api/__init__.py#L46-L48
```
# 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.
Contributor guide
Assessment
This issue has not been assessed yet.