File tree Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -438,18 +438,13 @@ def _type_object_overlap(left: Type, right: Type) -> bool:
438438 return _type_object_overlap (left , right ) or _type_object_overlap (right , left )
439439
440440 if isinstance (left , CallableType ) and isinstance (right , CallableType ):
441-
442- def _callable_overlap (left : CallableType , right : CallableType ) -> bool :
443- return is_callable_compatible (
444- left ,
445- right ,
446- is_compat = _is_overlapping_types ,
447- ignore_pos_arg_names = True ,
448- allow_partial_overlap = True ,
449- )
450-
451- # Compare both directions to handle type objects.
452- return _callable_overlap (left , right ) or _callable_overlap (right , left )
441+ return is_callable_compatible (
442+ left ,
443+ right ,
444+ is_compat = _is_overlapping_types ,
445+ ignore_pos_arg_names = True ,
446+ allow_partial_overlap = True ,
447+ )
453448 elif isinstance (left , CallableType ):
454449 left = left .fallback
455450 elif isinstance (right , CallableType ):
Original file line number Diff line number Diff line change @@ -1361,7 +1361,7 @@ def g(x: int) -> int: ...
13611361 ignore_pos_arg_names = True
13621362
13631363 # Non-type cannot be a subtype of type.
1364- if right .is_type_obj () and not left .is_type_obj ():
1364+ if right .is_type_obj () and not left .is_type_obj () and not allow_partial_overlap :
13651365 return False
13661366
13671367 # A callable L is a subtype of a generic callable R if L is a
You can’t perform that action at this time.
0 commit comments