Skip to content

Commit

Permalink
Add recursion limit variable
Browse files Browse the repository at this point in the history
  • Loading branch information
kcdodd committed Aug 25, 2024
1 parent 51edac6 commit 4cf6183
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion mypy/dmypy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import traceback
from typing import Any, Callable, Mapping, NoReturn

from mypy.main import RECURSION_LIMIT
from mypy.dmypy_os import alive, kill
from mypy.dmypy_util import DEFAULT_STATUS_FILE, receive, send
from mypy.ipc import IPCClient, IPCException
Expand Down Expand Up @@ -269,7 +270,7 @@ def main(argv: list[str]) -> None:
check_python_version("dmypy")

# set recursion limit consistent with mypy/main.py
sys.setrecursionlimit(2**14)
sys.setrecursionlimit(RECURSION_LIMIT)

args = parser.parse_args(argv)
if not args.action:
Expand Down
4 changes: 2 additions & 2 deletions mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

orig_stat: Final = os.stat
MEM_PROFILE: Final = False # If True, dump memory profile

RECURSION_LIMIT: Final = 2**14

def stat_proxy(path: str) -> os.stat_result:
try:
Expand Down Expand Up @@ -63,7 +63,7 @@ def main(
util.check_python_version("mypy")
t0 = time.time()
# To log stat() calls: os.stat = stat_proxy
sys.setrecursionlimit(2**14)
sys.setrecursionlimit(RECURSION_LIMIT)
if args is None:
args = sys.argv[1:]

Expand Down

0 comments on commit 4cf6183

Please sign in to comment.