Skip to content

Conversation

@thomasjpfan
Copy link
Contributor

When using PYTHONASYNCIODEBUG=1, the names of the original async functions are hidden. For example, on main and running with this file:

from synchronicity import Synchronizer
from synchronicity.async_utils import Runner


async def blocks_event_loop():
    import time

    time.sleep(0.5)


s = Synchronizer()


@s.wrap
async def my_custom_name():
    await blocks_event_loop()


with Runner() as runner:
    runner.run(my_custom_name.aio())

I get this output:

Executing <Task finished name='Task-6' coro=<Synchronizer._wrap_check_async_leakage.<locals>.coro_wrapped() done, defined at .../synchronicity/synchronizer.py:258> result=None created at .../synchronicity/synchronizer.py:415> took 0.501 seconds

The Synchronizer._wrap_check_async_leakage.<locals>.coro_wrapped makes it harder to find where the issue is.

Copy link
Contributor

@freider freider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! Before mergin - can you confirm this doesn't break the type stubs on the modal client somehow (by running inv type-check). I have a vague recollection about functools.wraps not transfering the iscoroutinefunction property, which at least historically had some downstream effects on type stubs (but that might have been fixed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants