File tree Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Expand file tree Collapse file tree 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):
20242024 raise TypeError ("Instance and class checks can only be used with"
20252025 " @runtime_checkable protocols" )
20262026
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 ):
20362028 return True
20372029
20382030 if is_protocol_cls :
20392031 getattr_static = _lazy_load_getattr_static ()
2040- for attr in protocol_attrs :
2032+ for attr in _get_protocol_attrs ( cls ) :
20412033 try :
20422034 val = getattr_static (instance , attr )
20432035 except AttributeError :
@@ -2047,7 +2039,7 @@ def __instancecheck__(cls, instance):
20472039 else :
20482040 return True
20492041
2050- return super (). __instancecheck__ ( instance )
2042+ return False
20512043
20522044
20532045class Protocol (Generic , metaclass = _ProtocolMeta ):
You can’t perform that action at this time.
0 commit comments