From de182676853e8de22363e8a0641c42392c0fdaa9 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 5 Apr 2023 17:37:36 +0100 Subject: gh-74690: Further optimise `typing._ProtocolMeta.__instancecheck__` (#103280) --- Lib/typing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/typing.py b/Lib/typing.py index b8420f6..1f1c4ff 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -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 -- cgit v0.12