Skip to content

Commit

Permalink
Add comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed May 6, 2023
1 parent e054f40 commit e735438
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion astroid/inference_tip.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ def inner(*args: _P.args, **kwargs: _P.kwargs) -> Iterator[InferenceResult]:
if partial_cache_key in _CURRENTLY_INFERRING:
# If through recursion we end up trying to infer the same
# func + node we raise here.
raise UseInferenceDefault()
raise UseInferenceDefault
try:
return _cache[func, node, context]
except KeyError:
# Recursion guard with a partial cache key.
# Using the full key causes a recursion error on PyPy.
# It's a pragmatic compromise to avoid so much recursive inference
# with slightly different contexts while still passing the simple
# test cases included with this commit.
_CURRENTLY_INFERRING.add(partial_cache_key)
result = _cache[func, node, context] = list(func(*args, **kwargs))
assert result
Expand Down

0 comments on commit e735438

Please sign in to comment.