davidhalter / davidhalter/jedi

importing jedi might lower your recursion limit

Open
#1,925 3 comments 0 reactions 0 assignees View on GitHub
bug low-prio
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.