Skip to content

Commit

Permalink
fix: cython function signature error (#495)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler authored Dec 17, 2024
1 parent 531d533 commit cda4178
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions a_sync/a_sync/_helpers.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit cda4178

Please sign in to comment.