Skip to content

Commit 30f1555

Browse files
authored
Union type fix for Python 3.9
Let's see whether using `TypeAlias` in here works ...
1 parent 0d99811 commit 30f1555

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

stdlib/typing_extensions.pyi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ from typing import ( # noqa: Y022,Y037,Y038,Y039,UP035
6868

6969
if sys.version_info >= (3, 10):
7070
from types import UnionType
71+
_UnionType: TypeAlias = UnionType
72+
else:
73+
_UnionType: TypeAlias = Any
7174

7275
# Please keep order the same as at runtime.
7376
__all__ = [
@@ -694,5 +697,5 @@ else:
694697
# PEP 661
695698
class Sentinel:
696699
def __init__(self, name: str, repr: str | None = None) -> None: ...
697-
def __or__(self, other: Any) -> UnionType: ... # other can be any type form legal for unions
698-
def __ror__(self, other: Any) -> UnionType: ... # other can be any type form legal for unions
700+
def __or__(self, other: Any) -> _UnionType: ... # other can be any type form legal for unions
701+
def __ror__(self, other: Any) -> _UnionType: ... # other can be any type form legal for unions

0 commit comments

Comments
 (0)