Skip to content

Commit d8efa86

Browse files
committed
less hacky way to narrow lhs defers
1 parent 3197cd7 commit d8efa86

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

mypy/semanal.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3294,10 +3294,11 @@ def should_wait_lhs(self, s: AssignmentStmt) -> bool:
32943294
# No chance, nothing has changed.
32953295
return False
32963296
if isinstance(s.type, UnboundType):
3297-
if s.type.name == "TypeAlias":
3298-
lookup = self.lookup_qualified(s.type.name, s, suppress_errors=True)
3299-
if lookup and isinstance(lookup.node, PlaceholderNode):
3300-
return True
3297+
lookup = self.lookup_qualified(s.type.name, s, suppress_errors=True)
3298+
if lookup and isinstance(lookup.node, PlaceholderNode):
3299+
if isinstance(lookup.node.node, ImportFrom):
3300+
if lookup.node.node.id in ("typing", "typing_extensions"):
3301+
return True
33013302
return False
33023303

33033304
def should_wait_rhs(self, rv: Expression) -> bool:

0 commit comments

Comments
 (0)