-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
pylint-dev/astroid
#731Labels
Crash 💥A bug that makes pylint crashA bug that makes pylint crashNeeds reproduction 🔍Need a way to reproduce it locally on a maintainer's machineNeed a way to reproduce it locally on a maintainer's machine
Description
I've encountered a very similar runtime error as the one in #2937. I've confirmed that the two code samples in that issue to reproduce the problem both work in my environment, so it's not a regression of that specific issue. Further, the problem appears under Python 3.7 but not under Python 3.6 (with the same versions of pylint and astroid for both).
There are no preview releases of pylint or astroid at the moment to check with.
Steps to reproduce
$ python3.7 -mvenv venv$ . venv/bin/activate$ pip install pylint objectpath$ pylint -j1 objectpath_pylint.pywhere objectpath_pylint.py is:
from objectpath import Tree
def foobar():
count = 0
while True:
tree = Tree({})
count += tree.execute('')
if count:
break(That's the minimal case to reproduce the issue, based on the original code the issue appeared in.)
Current behavior
************* Module objectpath_pylint
objectpath_pylint.py:1:0: C0114: Missing module docstring (missing-module-docstring)
objectpath_pylint.py:3:0: C0116: Missing function or method docstring (missing-function-docstring)
Traceback (most recent call last):
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x7fe0e17a98c0>, <Call l.551 at 0x7fe0e1099f10>)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 1677, in infer_call_result
yield from returnnode.value.infer(context)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/node_classes.py", line 353, in infer
return self._explicit_inference(self, context, **kwargs)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/__init__.py", line 93, in _inference_tip_cached
result = func(*args, **kwargs)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/brain/brain_builtin_inference.py", line 129, in _transform_wrapper
result = transform(node, context=context)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/brain/brain_builtin_inference.py", line 716, in infer_int
first_value = next(call.positional_arguments[0].infer(context=context))
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/tim/dev/pylint/venv/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/pylint/__init__.py", line 23, in run_pylint
PylintRun(sys.argv[1:])
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/pylint/lint.py", line 1731, in __init__
linter.check(args)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/pylint/lint.py", line 1004, in check
self._do_check(files_or_modules)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/pylint/lint.py", line 1165, in _do_check
self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/pylint/lint.py", line 1252, in check_astroid_module
walker.walk(ast_node)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/pylint/utils/ast_walker.py", line 77, in walk
self.walk(child)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/pylint/utils/ast_walker.py", line 77, in walk
self.walk(child)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/pylint/utils/ast_walker.py", line 77, in walk
self.walk(child)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/pylint/utils/ast_walker.py", line 74, in walk
callback(astroid)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/pylint/checkers/base.py", line 1024, in visit_if
self._check_using_constant_test(node, node.test)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/pylint/checkers/base.py", line 1062, in _check_using_constant_test
inferred = utils.safe_infer(test)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/pylint/checkers/utils.py", line 1084, in safe_infer
value = next(inferit)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred
yield next(generator)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/decorators.py", line 95, in wrapped
res = next(generator)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/bases.py", line 133, in _infer_stmts
for inferred in stmt.infer(context=context):
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/util.py", line 160, in limit_inference
yield from islice(iterator, size)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/context.py", line 113, in cache_generator
for result in generator:
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred
yield next(generator)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/decorators.py", line 95, in wrapped
res = next(generator)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/util.py", line 160, in limit_inference
yield from islice(iterator, size)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/context.py", line 113, in cache_generator
for result in generator:
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred
yield next(generator)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/decorators.py", line 95, in wrapped
res = next(generator)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/inference.py", line 468, in _filter_operation_errors
for result in infer_callable(self, context):
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/inference.py", line 787, in _infer_augassign
for lhs, rhs in itertools.product(lhs_iter, rhs_iter):
[Many repeated sequences of the some of the above lines omitted]
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/util.py", line 160, in limit_inference
yield from islice(iterator, size)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/context.py", line 113, in cache_generator
for result in generator:
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/decorators.py", line 141, in raise_if_nothing_inferred
yield from generator
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/decorators.py", line 95, in wrapped
res = next(generator)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/inference.py", line 227, in infer_call
yield from callee.infer_call_result(caller=self, context=callcontext)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 1677, in infer_call_result
yield from returnnode.value.infer(context)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/util.py", line 160, in limit_inference
yield from islice(iterator, size)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/context.py", line 113, in cache_generator
for result in generator:
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/decorators.py", line 141, in raise_if_nothing_inferred
yield from generator
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/decorators.py", line 95, in wrapped
res = next(generator)
File "/home/tim/dev/pylint/venv/lib/python3.7/site-packages/astroid/inference.py", line 227, in infer_call
yield from callee.infer_call_result(caller=self, context=callcontext)
RuntimeError: generator raised StopIteration
Expected behavior
************* Module objectpath_pylint
objectpath_pylint.py:1:0: C0114: Missing module docstring (missing-module-docstring)
objectpath_pylint.py:3:0: C0116: Missing function or method docstring (missing-function-docstring)
-----------------------------------
Your code has been rated at 7.50/10
That's the behaviour under Python 3.6; here's the pylint --version output for the above expected behaviour
pylint 2.4.4
astroid 2.3.3
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0]
pylint --version output
pylint 2.4.4
astroid 2.3.3
Python 3.7.5 (default, Nov 7 2019, 10:50:52)
[GCC 8.3.0]
Metadata
Metadata
Assignees
Labels
Crash 💥A bug that makes pylint crashA bug that makes pylint crashNeeds reproduction 🔍Need a way to reproduce it locally on a maintainer's machineNeed a way to reproduce it locally on a maintainer's machine