-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
pylint-dev/astroid
#1104Labels
Blocker 🙅Blocks the next releaseBlocks the next releaseCrash 💥A bug that makes pylint crashA bug that makes pylint crashNeeds astroid updateNeeds an astroid update (probably a release too) before being mergableNeeds an astroid update (probably a release too) before being mergable
Milestone
Description
Steps to reproduce
mycode.py
import contextlib
class A:
@contextlib.contextmanager
def get(self):
yield self
class B(A):
def play():
pass
def func():
with B().get() as b:
b.play()
(This is basically from this example: pylint-dev/astroid#1090 except I wrapped the with block in a function.)
Current behavior
(.ve3) bijan@system76-pc:~/pylint_fail$ PYTHONPATH=. pylint -j0 mycode.py
Exception on node <Call l.17 at 0x7f78c97bb0d0> in file '/home/bijan/pylint_fail/mycode.py'
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/astroid/protocols.py", line 494, in _infer_context_manager
yield next(inferred.infer_yield_types())
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/lint/parallel.py", line 69, in _worker_check_single_file
_worker_linter.check_single_file(name, filepath, modname)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 992, in check_single_file
self._check_file(
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1033, in _check_file
check_astroid_module(ast_node)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1170, in check_astroid_module
retval = self._check_astroid_module(
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1215, in _check_astroid_module
walker.walk(ast_node)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/utils/ast_walker.py", line 77, in walk
self.walk(child)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/utils/ast_walker.py", line 77, in walk
self.walk(child)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/utils/ast_walker.py", line 77, in walk
self.walk(child)
[Previous line repeated 1 more time]
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/utils/ast_walker.py", line 74, in walk
callback(astroid)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 885, in visit_call
self._check_consider_using_with(node)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 1290, in _check_consider_using_with
inferred = utils.safe_infer(node.func)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/checkers/utils.py", line 1177, in safe_infer
value = next(infer_gen)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/astroid/node_classes.py", line 354, in infer
yield from self._infer(context, **kwargs)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/astroid/decorators.py", line 136, in raise_if_nothing_inferred
yield next(generator)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/astroid/decorators.py", line 100, in wrapped
res = next(generator)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/astroid/inference.py", line 299, in infer_attribute
for owner in self.expr.infer(context):
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/astroid/node_classes.py", line 368, in infer
for i, result in enumerate(generator):
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/astroid/decorators.py", line 136, in raise_if_nothing_inferred
yield next(generator)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/astroid/decorators.py", line 100, in wrapped
res = next(generator)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/astroid/bases.py", line 146, in _infer_stmts
for inferred in stmt.infer(context=context):
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/astroid/node_classes.py", line 368, in infer
for i, result in enumerate(generator):
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/astroid/decorators.py", line 136, in raise_if_nothing_inferred
yield next(generator)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/astroid/decorators.py", line 97, in wrapped
generator = _func(node, context, **kwargs)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/astroid/inference.py", line 860, in infer_assign
stmts = list(self.assigned_stmts(context=context))
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/astroid/decorators.py", line 136, in raise_if_nothing_inferred
yield next(generator)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/astroid/protocols.py", line 541, in with_assigned_stmts
yield from _infer_context_manager(self, mgr, context)
RuntimeError: generator raised StopIteration
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/bijan/pylint_fail/.ve3/bin/pylint", line 8, in <module>
sys.exit(run_pylint())
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/__init__.py", line 24, in run_pylint
PylintRun(sys.argv[1:])
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/lint/run.py", line 384, in __init__
linter.check(args)
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 977, in check
check_parallel(
File "/home/bijan/pylint_fail/.ve3/lib/python3.8/site-packages/pylint/lint/parallel.py", line 140, in check_parallel
for (
File "/usr/lib/python3.8/multiprocessing/pool.py", line 868, in next
raise value
RuntimeError: generator raised StopIteration
Expected behavior
No exception raised.
pylint --version output
Result of pylint --version
output:
(.ve3) bijan@system76-pc:~/pylint_fail$ pylint --version
pylint 2.9.3
astroid 2.6.3
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0]
Additional dependencies:
(.ve3) bijan@system76-pc:~/pylint_fail$ pip freeze
astroid==2.6.3
isort==5.9.2
lazy-object-proxy==1.6.0
mccabe==0.6.1
pkg-resources==0.0.0
pylint==2.9.3
toml==0.10.2
wrapt==1.12.1
There is no issue if I pin to astroid==2.6.2
. Also, please let me know if this should be an astroid issue instead.
Metadata
Metadata
Assignees
Labels
Blocker 🙅Blocks the next releaseBlocks the next releaseCrash 💥A bug that makes pylint crashA bug that makes pylint crashNeeds astroid updateNeeds an astroid update (probably a release too) before being mergableNeeds an astroid update (probably a release too) before being mergable