File tree 1 file changed +3
-11
lines changed
1 file changed +3
-11
lines changed Original file line number Diff line number Diff line change @@ -2024,20 +2024,12 @@ def __instancecheck__(cls, instance):
2024
2024
raise TypeError ("Instance and class checks can only be used with"
2025
2025
" @runtime_checkable protocols" )
2026
2026
2027
- if not is_protocol_cls and issubclass (instance .__class__ , cls ):
2028
- return True
2029
-
2030
- protocol_attrs = _get_protocol_attrs (cls )
2031
-
2032
- if (
2033
- _is_callable_members_only (cls , protocol_attrs )
2034
- and issubclass (instance .__class__ , cls )
2035
- ):
2027
+ if super ().__instancecheck__ (instance ):
2036
2028
return True
2037
2029
2038
2030
if is_protocol_cls :
2039
2031
getattr_static = _lazy_load_getattr_static ()
2040
- for attr in protocol_attrs :
2032
+ for attr in _get_protocol_attrs ( cls ) :
2041
2033
try :
2042
2034
val = getattr_static (instance , attr )
2043
2035
except AttributeError :
@@ -2047,7 +2039,7 @@ def __instancecheck__(cls, instance):
2047
2039
else :
2048
2040
return True
2049
2041
2050
- return super (). __instancecheck__ ( instance )
2042
+ return False
2051
2043
2052
2044
2053
2045
class Protocol (Generic , metaclass = _ProtocolMeta ):
You can’t perform that action at this time.
0 commit comments