From f57ea0cb6dd7b4528ad7fa93edf40a3bfbeab6fb Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Thu, 29 Jan 2026 16:30:17 +0000 Subject: [PATCH] [conformance suite] Fix inaccurate comnent in `protocols_generic.py` This comment states that this class fails at runtime, but that isn't true: ```pycon >>> from typing import * >>> T_co = TypeVar("T_co") >>> class Proto2(Protocol[T_co], Generic[T_co]): ... ... >>> ``` The comment should instead quote the spec [here](https://typing.python.org/en/latest/spec/protocol.html#generic-protocols), which states that type checkers should consider it an error (even though it does not fail at runtime) --- conformance/tests/protocols_generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conformance/tests/protocols_generic.py b/conformance/tests/protocols_generic.py index 958864285..b417e00f6 100644 --- a/conformance/tests/protocols_generic.py +++ b/conformance/tests/protocols_generic.py @@ -40,7 +40,7 @@ def method1(self, x: str) -> str: p2: Proto1[int, str] = Concrete1() # E: incompatible type -# Runtime error: Protocol and Generic cannot be used together as base classes. +# > It is an error to combine the shorthand with Generic[T, S, ...] class Proto2(Protocol[T_co], Generic[T_co]): # E ...