mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
This commit is contained in:
parent
c851817aaa
commit
ca4b252fba
2 changed files with 21 additions and 2 deletions
|
@ -1503,6 +1503,8 @@ class _ProtocolMeta(GenericMeta):
|
|||
"""
|
||||
|
||||
def __instancecheck__(self, obj):
|
||||
if _Protocol not in self.__bases__:
|
||||
return super().__instancecheck__(obj)
|
||||
raise TypeError("Protocols cannot be used with isinstance().")
|
||||
|
||||
def __subclasscheck__(self, cls):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue