More precise type for TypeAliasType.__getitem__ (#12354)

At runtime, this always returns a GenericAlias; see typealias_subscript
in Objects/typevarobject.c. See microsoft/pyright#8444.
This commit is contained in:
Jelle Zijlstra
2024-07-17 06:37:31 -07:00
committed by GitHub
parent 6d68b57d74
commit d482d4e83c
2 changed files with 2 additions and 1 deletions

View File

@@ -1056,7 +1056,7 @@ if sys.version_info >= (3, 12):
# It's writable on types, but not on instances of TypeAliasType.
@property
def __module__(self) -> str | None: ... # type: ignore[override]
def __getitem__(self, parameters: Any) -> Any: ...
def __getitem__(self, parameters: Any) -> GenericAlias: ...
def __or__(self, right: Any) -> _SpecialForm: ...
def __ror__(self, left: Any) -> _SpecialForm: ...