Skip to content

Commit 9cb9ef3

Browse files
committed
Respond to upstream: use None as type sentinel
1 parent 03c89d9 commit 9cb9ef3

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

temporalio/nexus/handler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def _get_workflow_run_start_method_input_and_output_type_annotations(
5757
Awaitable[WorkflowHandle[Any, O]],
5858
],
5959
) -> tuple[
60-
Union[Type[I], Type[nexusrpc.handler.MISSING_TYPE]],
61-
Union[Type[O], Type[nexusrpc.handler.MISSING_TYPE]],
60+
Optional[Type[I]],
61+
Optional[Type[O]],
6262
]:
6363
"""Return operation input and output types.
6464
@@ -76,15 +76,15 @@ def _get_workflow_run_start_method_input_and_output_type_annotations(
7676
f"Expected return type of {start_method.__name__} to be a subclass of WorkflowHandle, "
7777
f"but is {output_type}"
7878
)
79-
output_type = nexusrpc.handler.MISSING_TYPE
79+
output_type = None
8080

8181
args = typing.get_args(output_type)
8282
if len(args) != 2:
8383
warnings.warn(
8484
f"Expected return type of {start_method.__name__} to have exactly two type parameters, "
8585
f"but has {len(args)}: {args}"
8686
)
87-
output_type = nexusrpc.handler.MISSING_TYPE
87+
output_type = None
8888
else:
8989
_wf_type, output_type = args
9090
return input_type, output_type

temporalio/worker/_nexus.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,12 +371,7 @@ async def deserialize(
371371
try:
372372
[input] = await self.data_converter.decode(
373373
[self.payload],
374-
type_hints=( # type: ignore
375-
[as_type]
376-
# TODO(nexus-prerelease): HACK
377-
if (as_type and as_type != nexusrpc.handler.MISSING_TYPE)
378-
else [Any]
379-
),
374+
type_hints=[as_type] if as_type else None,
380375
)
381376
except Exception as err:
382377
raise nexusrpc.handler.HandlerError(

0 commit comments

Comments
 (0)