From cda4178a5618d25c12acd664a5b8be88146e655f Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Tue, 17 Dec 2024 19:40:14 -0400 Subject: [PATCH] fix: cython function signature error (#495) --- a_sync/a_sync/_helpers.pyx | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/a_sync/a_sync/_helpers.pyx b/a_sync/a_sync/_helpers.pyx index 2283e01e..2cfe630b 100644 --- a/a_sync/a_sync/_helpers.pyx +++ b/a_sync/a_sync/_helpers.pyx @@ -99,18 +99,22 @@ cdef object _asyncify(object func, executor: Executor): # type: ignore [misc] run = executor.run - return wraps(func)( - lambda *args, **kwargs: run(func, *args, **kwargs) - ) + @wraps(func) + async def _asyncify_wrap_fast(*args: P.args, **kwargs: P.kwargs) -> T: + return await run(func, *args, **kwargs) + + return _asyncify_wrap_fast - cdef object submit = executor.submit + else: - @wraps(func) - async def _asyncify_wrap(*args: P.args, **kwargs: P.kwargs) -> T: - loop = get_event_loop() - fut = loop.create_future() - cf_fut = submit(func, *args, **kwargs) - _chain_future(cf_fut, fut) - return await fut + submit = executor.submit - return _asyncify_wrap + @wraps(func) + async def _asyncify_wrap(*args: P.args, **kwargs: P.kwargs) -> T: + loop = get_event_loop() + fut = loop.create_future() + cf_fut = submit(func, *args, **kwargs) + _chain_future(cf_fut, fut) + return await fut + + return _asyncify_wrap