File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments