Issue #28556: two more small upstream changes by Ivan Levkivskyi (#329, #330)

This commit is contained in:
Guido van Rossum 2016-11-19 10:32:41 -08:00
parent c851817aaa
commit ca4b252fba
2 changed files with 21 additions and 2 deletions

View file

@ -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):