From 56a499065b2146ca11c2ea0b3e871982502431dd Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sun, 26 Jun 2016 17:56:29 -0700 Subject: [PATCH] Don't crash in try_infer_partial_type() if var.type is None. Fixes #1747. --- mypy/checkexpr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/checkexpr.py b/mypy/checkexpr.py index 7782843b98f9..7ba3ff9dec45 100644 --- a/mypy/checkexpr.py +++ b/mypy/checkexpr.py @@ -157,7 +157,7 @@ def try_infer_partial_type(self, e: CallExpr) -> None: partial_types = self.chk.find_partial_types(var) if partial_types is not None and not self.chk.current_node_deferred: partial_type = cast(PartialType, var.type) - if partial_type.type is None: + if partial_type is None or partial_type.type is None: # A partial None type -> can't infer anything. return typename = partial_type.type.fullname()