Skip to content

Commit 5ea03af

Browse files
mbyrnepr2Mark ByrnePierre-Sassoulas
committed
Fix false positive for the unnecessary-ellipsis checker (#6039)
When an ellipsis is used in a lambda expression. Closes #6036 Co-authored-by: Mark Byrne <[email protected]> Co-authored-by: Pierre Sassoulas <[email protected]>
1 parent 8b20590 commit 5ea03af

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

ChangeLog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ Release date: TBA
2424

2525
Closes #6028
2626

27-
* Fix crash for ``unneccessary-ellipsis`` checker when an ellipsis is used inside of a container.
27+
* Fix crash for ``unneccessary-ellipsis`` checker when an ellipsis is used inside of a container or a lambda expression.
2828

29+
Closes #6036
2930
Closes #6037
3031
Closes #6048
3132

pylint/checkers/ellipsis_checker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def visit_const(self, node: nodes.Const) -> None:
4949
nodes.Assign,
5050
nodes.BaseContainer,
5151
nodes.Call,
52+
nodes.Lambda,
5253
),
5354
)
5455
and (

tests/functional/u/unnecessary/unnecessary_ellipsis.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ def __getitem__(self, index: Union[int, slice]) -> Union[int, List[int]]:
102102
def func_with_ellipsis_default_arg(a = ...) -> None:
103103
"Some docstring."
104104

105-
106105
# Ignore if the ellipsis is inside a container:
107106
my_list = [...]
108107
my_tuple = (...,)
@@ -112,3 +111,6 @@ def func_with_ellipsis_default_arg(a = ...) -> None:
112111
mydict1 = {'x': [...]}
113112
mydict2 = {'x': {...}}
114113
mydict3 = {'x': (...,)}
114+
115+
# Ignore if the ellipsis is used with a lambda expression
116+
print("x", lambda: ...)

0 commit comments

Comments
 (0)