Skip to content

Commit

Permalink
protobuf semantics differs on py3.9
Browse files Browse the repository at this point in the history
Signed-off-by: JackUrb <[email protected]>
  • Loading branch information
JackUrb committed Aug 15, 2024
1 parent 19d231e commit c411fc7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions flytekit/core/type_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,12 @@ def to_literal(self, ctx: FlyteContext, python_val: T, python_type: Type[T], exp
struct = Struct()
try:
message_dict = _MessageToDict(cast(Message, python_val))
if isinstance(message_dict, list):
return self._handle_list_literal(ctx, message_dict)
struct.update(message_dict)
try:
struct.update(message_dict)
except Exception:

Check warning on line 723 in flytekit/core/type_engine.py

View check run for this annotation

Codecov / codecov/patch

flytekit/core/type_engine.py#L720-L723

Added lines #L720 - L723 were not covered by tests
if isinstance(message_dict, list):
return self._handle_list_literal(ctx, message_dict)
raise

Check warning on line 726 in flytekit/core/type_engine.py

View check run for this annotation

Codecov / codecov/patch

flytekit/core/type_engine.py#L725-L726

Added lines #L725 - L726 were not covered by tests
except Exception:
raise TypeTransformerFailedError("Failed to convert to generic protobuf struct")
return Literal(scalar=Scalar(generic=struct))
Expand Down

0 comments on commit c411fc7

Please sign in to comment.