Skip to content

Commit

Permalink
Add a regression test for generator raised StopIteration #4723
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Jul 19, 2021
1 parent f437752 commit 4b0ea31
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ Release date: TBA

Closes #4685

* Fix a crash when a StopIteration was raised when inferring
a faulty function in a context manager.

Closes #4723


What's New in Pylint 2.9.3?
===========================
Expand Down
21 changes: 21 additions & 0 deletions tests/functional/r/regression/regression_4723.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Latest version of astroid (2.6.3) causes RuntimeError:
generator raised StopIteration #4723"""
# pylint: disable=invalid-name,missing-docstring,too-few-public-methods

import contextlib


class A:
@contextlib.contextmanager
def get(self):
yield self


class B(A):
def play(): # [no-method-argument]
pass


def func():
with B().get() as b:
b.play()
1 change: 1 addition & 0 deletions tests/functional/r/regression/regression_4723.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
no-method-argument:15:4:B.play:Method has no argument:HIGH

0 comments on commit 4b0ea31

Please sign in to comment.