Message412618
typing.TypeAlias is allowed to be bare, but it's not listed in the list of types in typing._type_check that are allowed to be bare. This means it's possible to reach the wrong error `TypeError: Plain typing.TypeAlias is not valid as type argument` at runtime.
Examples offhand:
from typing import TypeAlias, get_type_hints
class A:
a: "TypeAlias" = int
get_type_hints(A)
from typing import Annotated, TypeAlias
b: Annotated[TypeAlias, ""] = int
There's likely more and/or more realistic ways to trigger the problem. Anything that triggers typing._type_check on typing.TypeAlias will give this error (TypeError: Plain typing.TypeAlias is not valid as type argument).
I will fix this by adding TypeAlias to the list of typing special forms allowed to be bare/plain. I intend to move these to their own named var to reduce the chance of types not getting added in the future. |
|
Date |
User |
Action |
Args |
2022-02-06 07:30:06 | GBeauregard | set | recipients:
+ GBeauregard |
2022-02-06 07:30:06 | GBeauregard | set | messageid: <1644132606.43.0.5970530565.issue46655@roundup.psfhosted.org> |
2022-02-06 07:30:06 | GBeauregard | link | issue46655 messages |
2022-02-06 07:30:06 | GBeauregard | create | |
|