Skip to content

Commit 5912ded

Browse files
fix failing test
1 parent 8b16f8d commit 5912ded

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

mypy/checker.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6188,10 +6188,13 @@ def find_isinstance_check_helper(
61886188
# For temporaries (e.g., E()(x)), we extract type_is/type_guard from the __call__ method.
61896189
# For named callables (e.g., is_int(x)), we extract type_is/type_guard directly from the RefExpr.
61906190
type_is, type_guard = None, None
6191-
called_type = get_proper_type(self.lookup_type(node.callee))
6191+
try:
6192+
called_type = get_proper_type(self.lookup_type(node.callee))
6193+
except KeyError:
6194+
called_type = None
61926195
# TODO: there are some more cases in check_call() to handle.
61936196
# If the callee is an instance, try to extract TypeGuard/TypeIs from its __call__ method.
6194-
if isinstance(called_type, Instance):
6197+
if called_type and isinstance(called_type, Instance):
61956198
call = find_member("__call__", called_type, called_type, is_operator=True)
61966199
if call is not None:
61976200
called_type = get_proper_type(call)

0 commit comments

Comments
 (0)