cc @sobolevn since you've been doing stuff here
Bug Report
Slots become part of a interface with protocols, they shouldn't be.
To Reproduce
importtyping@typing.runtime_checkableclassFoo(typing.Protocol):
__slots__= ()
classBar:
pass_T=typing.TypeVar("_T", bound="Foo")
deffoo(f: _T) ->_T:
returnfprint(issubclass(Bar, Foo))
print(isinstance(Bar(), Foo))
foo(Bar())Expected Behavior
At runtime this prints:
So issubclass is allowed, and I don't see why the TypeVar bounds shouldn't be.
Actual Behavior
main.py:17: error: Only protocols that don't have non-method members can be used with issubclass()
main.py:17: note: Protocol "Foo" has non-method member(s): __slots__
main.py:19: error: Value of type variable "_T" of "foo" cannot be "Bar"
Found 2 errors in 1 file (checked 1 source file)
Your Environment
mypy playground
cc @sobolevn since you've been doing stuff here
Bug Report
Slots become part of a interface with protocols, they shouldn't be.
To Reproduce
Expected Behavior
At runtime this prints:
So issubclass is allowed, and I don't see why the TypeVar bounds shouldn't be.
Actual Behavior
Your Environment
mypy playground