We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6aa1041 commit 93a1874Copy full SHA for 93a1874
mypy/semanal.py
@@ -1788,7 +1788,9 @@ def visit_assignment_stmt(self, s: AssignmentStmt) -> None:
1788
# Set the type if the rvalue is a simple literal (even if the above error occurred).
1789
if len(s.lvalues) == 1 and isinstance(s.lvalues[0], NameExpr):
1790
if s.lvalues[0].is_inferred_def:
1791
- s.type = self.analyze_simple_literal_type(s.rvalue)
+ # Except if it's an assignment to '_'.
1792
+ if s.lvalues[0].name != '_':
1793
+ s.type = self.analyze_simple_literal_type(s.rvalue)
1794
if s.type:
1795
# Store type into nodes.
1796
for lvalue in s.lvalues:
0 commit comments