Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cython function signature error #495

Merged
merged 1 commit into from
Dec 17, 2024
Merged
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
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
Loading