From d9edf14b6b513015b654f893f67dea1223fa3c90 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 5 Apr 2023 17:37:36 +0100 Subject: [PATCH] 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 b8420f619a1d050..1f1c4ffa2566ab3 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -2039,7 +2039,7 @@ def __instancecheck__(cls, instance): 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