Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion temporalio/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import inspect
import logging
import threading
import typing
import uuid
import warnings
from abc import ABC, abstractmethod
Expand Down Expand Up @@ -1919,7 +1920,10 @@ def _assert_dynamic_handler_args(
not arg_types
or len(arg_types) != 2
or arg_types[0] != str
or arg_types[1] != Sequence[temporalio.common.RawValue]
or (
arg_types[1] != Sequence[temporalio.common.RawValue]
and arg_types[1] != typing.Sequence[temporalio.common.RawValue]
)
):
raise RuntimeError(
"Dynamic handler must have 3 arguments: self, str, and Sequence[temporalio.common.RawValue]"
Expand Down
22 changes: 22 additions & 0 deletions tests/test_workflow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import inspect
import itertools
import typing
from collections.abc import Callable, Sequence
from typing import Any, Set, Type, get_type_hints

Expand Down Expand Up @@ -70,6 +71,27 @@ def update3(self, name: str, args: Sequence[RawValue]):
pass


@workflow.defn()
class GoodDefnDeprecatedTypes(GoodDefnBase):
# Just having the definition here is enough to confirm the signatures
# do not trigger a RuntimeError
@workflow.run
async def run(self, name: str) -> str:
raise NotImplementedError

@workflow.signal(dynamic=True)
def signal(self, name: str, args: typing.Sequence[RawValue]):
pass

@workflow.query(dynamic=True)
def query(self, name: str, args: typing.Sequence[RawValue]):
pass

@workflow.update(dynamic=True)
def update(self, name: str, args: typing.Sequence[RawValue]):
pass


def test_workflow_defn_good():
# Although the API is internal, we want to check the literal definition just
# in case
Expand Down
6 changes: 3 additions & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.