You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[case testRuntimeProtoTwoBases]
from typing_extensions import Protocol, runtime_checkable
from typing import TypeVar, Generic
T = TypeVar('T')
@runtime_checkable
class P(Protocol, Generic[T]):
attr: T
class C:
attr: int
x: P[int] = C()
fails with
main:7: error: @runtime_checkable can only be used with protocol classes
main:13: error: Incompatible types in assignment (expression has type "C", variable has type "P[int]")
Both replacing Protocol, Generic[T] with Protocol[T], and changing the order of bases to Generic[T], Protocol fixes the issue.