]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-74690: Further optimise `typing._ProtocolMeta.__instancecheck__` (#103280)
authorAlex Waygood <Alex.Waygood@Gmail.com>
Wed, 5 Apr 2023 16:37:36 +0000 (17:37 +0100)
committerGitHub <noreply@github.com>
Wed, 5 Apr 2023 16:37:36 +0000 (17:37 +0100)
Lib/typing.py

index b8420f619a1d05055809aecad6a014feb44df9a4..1f1c4ffa2566ab32ba341d1babd5314c01256f71 100644 (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