summaryrefslogtreecommitdiff
path: root/astroid/inference_tip.py
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2022-05-17 07:25:00 -0400
committerGitHub <noreply@github.com>2022-05-17 13:25:00 +0200
commit33b6c56bb2a80ce3be7d14d640f1a92cfb7cef1a (patch)
treecabc6760d57e7192729df2f740b0cf2c4ed477d4 /astroid/inference_tip.py
parentcc37d58493cb21506cb0fb93aed551b7881b40da (diff)
downloadastroid-git-33b6c56bb2a80ce3be7d14d640f1a92cfb7cef1a.tar.gz
Revert "Add a bound to the inference tips cache (#1565)" (#1570)
This reverts commit 95bbd5ed58da9e56da8d705e1893a804787f1998.
Diffstat (limited to 'astroid/inference_tip.py')
-rw-r--r--astroid/inference_tip.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/astroid/inference_tip.py b/astroid/inference_tip.py
index 97e7ac52..341efd63 100644
--- a/astroid/inference_tip.py
+++ b/astroid/inference_tip.py
@@ -7,7 +7,6 @@
from __future__ import annotations
import typing
-from collections import OrderedDict
from collections.abc import Iterator
import wrapt
@@ -21,7 +20,7 @@ InferOptions = typing.Union[
NodeNG, bases.Instance, bases.UnboundMethod, typing.Type[util.Uninferable]
]
-_cache: OrderedDict[tuple[InferFn, NodeNG], list[InferOptions] | None] = OrderedDict()
+_cache: dict[tuple[InferFn, NodeNG], list[InferOptions] | None] = {}
def clear_inference_tip_cache():
@@ -37,14 +36,11 @@ def _inference_tip_cached(
node = args[0]
try:
result = _cache[func, node]
- _cache.move_to_end((func, node))
# If through recursion we end up trying to infer the same
# func + node we raise here.
if result is None:
raise UseInferenceDefault()
except KeyError:
- if len(_cache) > 127:
- _cache.popitem(last=False)
_cache[func, node] = None
result = _cache[func, node] = list(func(*args, **kwargs))
assert result