Skip to content

Commit f57ea0c

Browse files
authored
[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)
1 parent 444e43e commit f57ea0c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

conformance/tests/protocols_generic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def method1(self, x: str) -> str:
4040
p2: Proto1[int, str] = Concrete1() # E: incompatible type
4141

4242

43-
# Runtime error: Protocol and Generic cannot be used together as base classes.
43+
# > It is an error to combine the shorthand with Generic[T, S, ...]
4444
class Proto2(Protocol[T_co], Generic[T_co]): # E
4545
...
4646

0 commit comments

Comments
 (0)