File tree 2 files changed +8
-13
lines changed
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:
438
438
return _type_object_overlap (left , right ) or _type_object_overlap (right , left )
439
439
440
440
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
+ )
453
448
elif isinstance (left , CallableType ):
454
449
left = left .fallback
455
450
elif isinstance (right , CallableType ):
Original file line number Diff line number Diff line change @@ -1361,7 +1361,7 @@ def g(x: int) -> int: ...
1361
1361
ignore_pos_arg_names = True
1362
1362
1363
1363
# 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 :
1365
1365
return False
1366
1366
1367
1367
# 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