Skip to content

Commit 93a1874

Browse files
author
Guido van Rossum
committed
Fix tests, add tests for globals and classvars, make those tests work
1 parent 6aa1041 commit 93a1874

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mypy/semanal.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,9 @@ def visit_assignment_stmt(self, s: AssignmentStmt) -> None:
17881788
# Set the type if the rvalue is a simple literal (even if the above error occurred).
17891789
if len(s.lvalues) == 1 and isinstance(s.lvalues[0], NameExpr):
17901790
if s.lvalues[0].is_inferred_def:
1791-
s.type = self.analyze_simple_literal_type(s.rvalue)
1791+
# Except if it's an assignment to '_'.
1792+
if s.lvalues[0].name != '_':
1793+
s.type = self.analyze_simple_literal_type(s.rvalue)
17921794
if s.type:
17931795
# Store type into nodes.
17941796
for lvalue in s.lvalues:

0 commit comments

Comments
 (0)