gh-74690: Further optimise typing._ProtocolMeta.__instancecheck__ (#103280)

This commit is contained in:
Alex Waygood 2023-04-05 17:37:36 +01:00 committed by GitHub
parent 96e1901a59
commit de18267685
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2039,7 +2039,7 @@ class _ProtocolMeta(ABCMeta):
val = getattr_static(instance, attr)
except AttributeError:
break
if callable(getattr(cls, attr, None)) and val is None:
if val is None and callable(getattr(cls, attr, None)):
break
else:
return True