compat: workaround for Literal to work in runtime in python<3.8
previously it would crash with: SyntaxError: Forward reference must be an expression -- got 'yield' (reproducible via python3 -c 'from typing import Union; Union[int, "yield"]' )
This commit is contained in:
parent
382f205429
commit
6e921627d3
1 changed files with 4 additions and 2 deletions
|
@ -58,9 +58,11 @@ else:
|
|||
if TYPE_CHECKING:
|
||||
from typing_extensions import Literal
|
||||
else:
|
||||
from typing import Union
|
||||
# erm.. I guess as long as it's not crashing, whatever...
|
||||
Literal = Union
|
||||
class _Literal:
|
||||
def __getitem__(self, args):
|
||||
pass
|
||||
Literal = _Literal()
|
||||
|
||||
|
||||
import os
|
||||
|
|
Loading…
Add table
Reference in a new issue