diff options
author | Marc Mueller <30130371+cdce8p@users.noreply.github.com> | 2023-01-29 16:43:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-29 16:43:30 +0100 |
commit | 68bf7d5034bedb3881ee679a2edc39d7928ae8d2 (patch) | |
tree | ab1335dbf885ce6fd9ce47f16a6be5064244436a /astroid/__init__.py | |
parent | a0d219cb3403cda3338a14ce67a60954b4ff5cd7 (diff) | |
download | astroid-git-68bf7d5034bedb3881ee679a2edc39d7928ae8d2.tar.gz |
Set higher recusion limit (2**12) for PyPy (#1984)
Diffstat (limited to 'astroid/__init__.py')
-rw-r--r-- | astroid/__init__.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/astroid/__init__.py b/astroid/__init__.py index 605a8b48..05a4ff78 100644 --- a/astroid/__init__.py +++ b/astroid/__init__.py @@ -31,6 +31,7 @@ Main modules are: """ import functools +import sys import tokenize from importlib import import_module @@ -48,7 +49,15 @@ from astroid.astroid_manager import MANAGER from astroid.bases import BaseInstance, BoundMethod, Instance, UnboundMethod from astroid.brain.helpers import register_module_extender from astroid.builder import extract_node, parse -from astroid.const import BRAIN_MODULES_DIRECTORY, PY310_PLUS, Context, Del, Load, Store +from astroid.const import ( + BRAIN_MODULES_DIRECTORY, + IS_PYPY, + PY310_PLUS, + Context, + Del, + Load, + Store, +) from astroid.exceptions import ( AstroidBuildingError, AstroidBuildingException, @@ -191,6 +200,10 @@ if ( ): tokenize._compile = functools.lru_cache()(tokenize._compile) # type: ignore[attr-defined] +if IS_PYPY: + # Set a higher recursion limit for PyPy. 1000 is a bit low. + sys.setrecursionlimit(2**12) + # load brain plugins for module in BRAIN_MODULES_DIRECTORY.iterdir(): if module.suffix == ".py": |