Skip to content

Commit 56a4990

Browse files
author
Guido van Rossum
committed
Don't crash in try_infer_partial_type() if var.type is None.
Fixes #1747.
1 parent b19b899 commit 56a4990

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/checkexpr.py

+1-1
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)