Things to check first
Typeguard version
4.0
Python version
3.9.16
What happened?
>>> from typeguard import check_type
>>> from typing import Literal
>>> check_type(42, Literal["hello"])
42
>>> from typing_extensions import Literal
>>> check_type(42, Literal["hello"])
typeguard.TypeCheckError: int is not any of ('hello')
How can we reproduce the bug?
It looks like typing_extensions.Literal works fine, but typing.Literal in 3.9 checking simple int on Literal["hello"] passes incorrectly. typing extensions version I have is 4.6. My guess is issue is related to here. Unsure why Literal is imported in 3.11 from typing, but both typing.Literal and typing_extensions.Literal need to be in origin_type_checkers. Or some more type normalization needs to happen.
My guess is other imports there like LiteralString may have similar bug.
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.0
Python version
3.9.16
What happened?
How can we reproduce the bug?
It looks like typing_extensions.Literal works fine, but typing.Literal in 3.9 checking simple int on Literal["hello"] passes incorrectly. typing extensions version I have is 4.6. My guess is issue is related to here. Unsure why Literal is imported in 3.11 from typing, but both typing.Literal and typing_extensions.Literal need to be in origin_type_checkers. Or some more type normalization needs to happen.
My guess is other imports there like LiteralString may have similar bug.