acoustic-carpenter-78188
04/04/2024, 4:01 PMint|None
as a way of specifying optional and union types.
But flytekit TypeEngine resolves this to pickle as it does not understand that it is infact a union.
But if you use typing.Union[int, None]
or typing.Optional[int]
these work fine.
On 3.9 python has an error and flytekit bubbles this error
def double(x: int | None) -> int:
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
Flytekit bubble
Failed with Unknown Exception <class 'TypeError'> Reason: unsupported operand type(s) for |: 'type' and 'NoneType'
and also an associated Long stack trace, that originates in import lib. We can simplify this and simply show the same error as python
Expected behavior
def foo(t: int|None):
or def foo(t: Optional[int])
both should work
Additional context to reproduce
No response
Screenshots
No response
Are you sure this issue hasn't been raised already?
☑︎ Yes
Have you read the Code of Conduct?
☑︎ Yes
flyteorg/flyteacoustic-carpenter-78188
04/04/2024, 4:01 PM