Fix: typing in async_run
This commit is contained in:
@@ -122,8 +122,8 @@ def set_async_ctx(ctx: AsyncContext) -> None:
|
|||||||
|
|
||||||
class AsyncThread(threading.Thread, Generic[P, R]):
|
class AsyncThread(threading.Thread, Generic[P, R]):
|
||||||
function: Callable[P, R]
|
function: Callable[P, R]
|
||||||
args: Any
|
args: tuple[Any, ...]
|
||||||
kwargs: Any
|
kwargs: dict[str, Any]
|
||||||
result: AsyncResult[R] | None
|
result: AsyncResult[R] | None
|
||||||
finished: bool
|
finished: bool
|
||||||
condition: threading.Condition
|
condition: threading.Condition
|
||||||
@@ -155,6 +155,7 @@ class AsyncThread(threading.Thread, Generic[P, R]):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
set_async_ctx(self.async_opts.async_ctx)
|
set_async_ctx(self.async_opts.async_ctx)
|
||||||
|
# Arguments for ParamSpec "P@AsyncThread" are missing
|
||||||
self.result = AsyncResult(_result=self.function(*self.args, **self.kwargs))
|
self.result = AsyncResult(_result=self.function(*self.args, **self.kwargs))
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.result = AsyncResult(_result=ex)
|
self.result = AsyncResult(_result=ex)
|
||||||
|
|||||||
Reference in New Issue
Block a user