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
I have searched the existing issues and didn't find my bug already reported there
I have checked that my bug is still present in the latest release
Typeguard version
4.2.1
Python version
3.12.1
What happened?
Typeguard reports incompatibilities between a the values of a type variable and its type (I hope that makes sense). The value of type_argument is Class, which is a type derived from Base, so it should be compatible with type[Base].
How can we reproduce the bug?
bug.py
fromtypingimportProtocol, runtime_checkablefromtypeguardimporttypechecked@runtime_checkableclassBase(Protocol):
number: intclassClass(Base):
number: int@typecheckeddefbug(type_argument: type[Base]) ->None:
print(type_argument)
# mypy and pyright say this is OK:type_argument: type[Base] =Class# typeguard says this is not ok:bug(Class)
mypy bug.py
pyright bug.py
python bug.py
typeguard.TypeCheckError: argument "type_argument" (class __main__.Class) is not compatible with the Base protocol
The text was updated successfully, but these errors were encountered:
Things to check first
I have searched the existing issues and didn't find my bug already reported there
I have checked that my bug is still present in the latest release
Typeguard version
4.2.1
Python version
3.12.1
What happened?
Typeguard reports incompatibilities between a the values of a type variable and its type (I hope that makes sense). The value of
type_argument
isClass
, which is a type derived fromBase
, so it should be compatible withtype[Base]
.How can we reproduce the bug?
bug.py
The text was updated successfully, but these errors were encountered: