skogsbaer / write-your-python-program

BSD 3-Clause "New" or "Revised" License
1 stars 4 forks source link

| as shortcut for typing.Union not supported #114

Closed skogsbaer closed 2 years ago

skogsbaer commented 2 years ago
def foo(x: int | str) -> None:
    print(x)

foo(1)

Unexpected error:

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    def foo(x: int | str) -> None:
AttributeError: 'types.UnionType' object has no attribute '__origin__'
skogsbaer commented 2 years ago

fixed in 1.0.2