Skip to content

Commit 4b0ea31

Browse files
Add a regression test for generator raised StopIteration #4723
1 parent f437752 commit 4b0ea31

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ Release date: TBA
8484

8585
Closes #4685
8686

87+
* Fix a crash when a StopIteration was raised when inferring
88+
a faulty function in a context manager.
89+
90+
Closes #4723
91+
8792

8893
What's New in Pylint 2.9.3?
8994
===========================
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""Latest version of astroid (2.6.3) causes RuntimeError:
2+
generator raised StopIteration #4723"""
3+
# pylint: disable=invalid-name,missing-docstring,too-few-public-methods
4+
5+
import contextlib
6+
7+
8+
class A:
9+
@contextlib.contextmanager
10+
def get(self):
11+
yield self
12+
13+
14+
class B(A):
15+
def play(): # [no-method-argument]
16+
pass
17+
18+
19+
def func():
20+
with B().get() as b:
21+
b.play()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
no-method-argument:15:4:B.play:Method has no argument:HIGH

0 commit comments

Comments
 (0)