1
0
forked from VimPlug/jedi

Make sure docstrings can always be inferred for builtins modules, fixes #1432

This commit is contained in:
Dave Halter
2019-12-11 00:04:25 +01:00
parent 3065609162
commit a2cebc4b92
3 changed files with 17 additions and 2 deletions

View File

@@ -45,7 +45,16 @@ def _limit_value_infers(func):
inference_state = context.inference_state
try:
inference_state.inferred_element_counts[n] += 1
if inference_state.inferred_element_counts[n] > 300:
maximum = 300
if context.parent_context is None \
and context.get_value() is inference_state.builtins_module:
# Builtins should have a more generous inference limit.
# It is important that builtins can be executed, otherwise some
# functions that depend on certain builtins features would be
# broken, see e.g. GH #1432
maximum *= 100
if inference_state.inferred_element_counts[n] > maximum:
debug.warning('In value %s there were too many inferences.', n)
return NO_VALUES
except KeyError: