Skip to content

Commit 700f511

Browse files
committed
Update starred expression error inline with Python
1 parent 090a414 commit 700f511

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

mypy/semanal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4997,7 +4997,7 @@ def visit_dict_expr(self, expr: DictExpr) -> None:
49974997

49984998
def visit_star_expr(self, expr: StarExpr) -> None:
49994999
if not expr.valid:
5000-
self.fail("Can use starred expression only as assignment target", expr, blocker=True)
5000+
self.fail("can't use starred expression here", expr, blocker=True)
50015001
else:
50025002
expr.expr.accept(self)
50035003

test-data/unit/check-statements.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2232,7 +2232,7 @@ def foo(x: int) -> Union[Generator[A, None, None], Generator[B, None, None]]:
22322232
yield x # E: Incompatible types in "yield" (actual type "int", expected type "Union[A, B]")
22332233

22342234
[case testNoCrashOnStarRightHandSide]
2235-
x = *(1, 2, 3) # E: Can use starred expression only as assignment target
2235+
x = *(1, 2, 3) # E: can't use starred expression here
22362236
[builtins fixtures/tuple.pyi]
22372237

22382238

test-data/unit/check-tuples.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ a = (0, *b, '')
11181118
[builtins fixtures/tuple.pyi]
11191119

11201120
[case testUnpackSyntaxError]
1121-
*foo # E: Can use starred expression only as assignment target
1121+
*foo # E: can't use starred expression here
11221122
[builtins fixtures/tuple.pyi]
11231123

11241124
[case testUnpackBases]

test-data/unit/semanal-errors.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,13 @@ c = 1
480480
d = 1
481481
a = *b
482482
[out]
483-
main:4: error: Can use starred expression only as assignment target
483+
main:4: error: can't use starred expression here
484484

485485
[case testStarExpressionInExp]
486486
a = 1
487487
*a + 1
488488
[out]
489-
main:2: error: Can use starred expression only as assignment target
489+
main:2: error: can't use starred expression here
490490

491491
[case testInvalidDel1]
492492
x = 1

0 commit comments

Comments
 (0)