From e9c67db724e130e3a3929cf41355ec28c0d6ff57 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 9 Feb 2024 13:27:33 +0000 Subject: [PATCH] Stubtest: ignore a new protocol dunder (#16895) This is added to all protocol classes on Python 3.12.2+ (it was added in a patch release of 3.12 as part of a bugfix). There's no reason why you'd want to explicitly include it in a stub (and doing so would lead the type checker to incorrectly conclude that you wanted a member literally called `__non_callable_proto_members__`) Cf. https://github.com/python/typeshed/pull/11384 and https://github.com/python/typeshed/issues/11383 (cherry picked from commit 517f5aee23ba218f615bcd4427bca62f120bc222) --- mypy/stubtest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mypy/stubtest.py b/mypy/stubtest.py index 0e8a1c3ceac2..c2f82c98d089 100644 --- a/mypy/stubtest.py +++ b/mypy/stubtest.py @@ -1486,6 +1486,7 @@ def verify_typealias( # Added to all protocol classes on 3.12+ (or if using typing_extensions.Protocol) "__protocol_attrs__", "__callable_proto_members_only__", + "__non_callable_proto_members__", # typing implementation details, consider removing some of these: "__parameters__", "__origin__",