Skip to content

Commit 53d6e24

Browse files
gvanrossumJukkaL
authored andcommitted
Don't crash in try_infer_partial_type() if var.type is None. (#1752)
Fixes #1747.
1 parent 32062eb commit 53d6e24

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/checkexpr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def try_infer_partial_type(self, e: CallExpr) -> None:
157157
partial_types = self.chk.find_partial_types(var)
158158
if partial_types is not None and not self.chk.current_node_deferred:
159159
partial_type = cast(PartialType, var.type)
160-
if partial_type.type is None:
160+
if partial_type is None or partial_type.type is None:
161161
# A partial None type -> can't infer anything.
162162
return
163163
typename = partial_type.type.fullname()

0 commit comments

Comments
 (0)